- Home /
What is the diffrence between Reference and GetComponent ?
in the both ways you can access the classes members i am confused ?
Answer by LilGames · Aug 14, 2017 at 02:38 PM
They are both technically a "reference" to the object, method or class, etc. The main difference (AFAIK) is when people talk about creating a "reference" they mean you define a public variable which can then be assigned a GameObject via the inspector. (That creates a "reference" your script can access).
Using GetComponent is the same thing but is done at run-time within your script.
Your answer
Follow this Question
Related Questions
Why we have to use getcomponent instead of a simple reference ? 2 Answers
Can I use GetComponents reference outside Of awake and start functions 1 Answer
Load Google Play Popup during Unity startup on Android? 1 Answer
How to create a Drop Down menu for a script file? 1 Answer
Can I make Money collecting script without attaching it to a object ? I tried but I got error 2 Answers