A problem people new to Unity and scrpting may run in:
I have a variable.
I know it will be only assigned to a single GameObject or Component for the whole time,
I know exactly what this GameObject or Component is,
I know it will be assigned only once in function Awake and
I know that I will be doing only stuff that does not require any dynamic/inference typing.
I also know that dynamic/inference typing is much slower than static typing (even if the variable is assigned right away in function Awake and then never changes), so I want to avoid it.
What I don't know is:
What type do I have to assign to my variable, that the things I want to do with it will work?
(Example: myVariable = GameObject.Find(“Whatever”); I would assume that myVariable would be of type GameObject. However, if I work with it I get errors saying I can’t do this or that with “UnityEngine.GameObject”.)
Is there a way to find out (with a Debug.Log or something) of what type my dynamically typed variable currently is? (So that I can then assign that type statically)
Thanks & Greetz, Ky.