Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add RequireComponent Helper #608

Closed
diadas opened this issue Jun 22, 2018 · 4 comments
Closed

Add RequireComponent Helper #608

diadas opened this issue Jun 22, 2018 · 4 comments
Assignees
Milestone

Comments

@diadas
Copy link

diadas commented Jun 22, 2018

I would like to have a helper function for creating "RequireComponent"-Tags.

See: https://docs.unity3d.com/ScriptReference/RequireComponent.html

I imagine it like this when the cursor is on the field:
[ light bulb ] private Image _image;
Pressing on the light bulb, the following menu entry will be available:
"Require Component >"
Pressing this, [RequireComponent(typeof(Image))] will be added to the class
When pressing on the ">", the options "Assign at Start()" and "Assign at Awake()" appear.
Both will add the tag to the class and additionally add code to the according magic functions:

Assign at Start() =
void Start() { _image = GetComponent<Image>(); }
Assign at Awake() =
void Awake() { _image = GetComponent<Image>(); }

@diadas
Copy link
Author

diadas commented Nov 20, 2018

See also #356

@krasnotsvetov krasnotsvetov self-assigned this Apr 25, 2019
@krasnotsvetov
Copy link
Collaborator

krasnotsvetov commented Apr 25, 2019

Partly implemented in #1152

@krasnotsvetov krasnotsvetov modified the milestones: Backlog, Rider 2019.2 Apr 25, 2019
@oxysoft
Copy link

oxysoft commented Jun 15, 2019

Note this could also be triggered with a quick-fix on the RequireComponent attribute itself, rather than initiating it from a field in the class. (in case the user started his work there first)

@citizenmatt
Copy link
Member

Closed with #1259

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

5 participants