very simple question (hopefully) with s simple answer. I got a script from one of my friends and it used public variables to get the components<, in unity 5 how do I declare what component it should be associated with?
(I tried the little circle thing and nothing came up)
after the monobehavior line you do :
public typeofvariable nameofvariable
example:
public Rigidbody myrigid ;
in start you assign :
nameofvariable = getcomponent();
example:
myrigid = getcomponent();
in other functions such as update , you can access through :
nameofvariable.anyfunction(etc)
example:
myrigid.velocity() etc…
Hope it helps