Quantcast
Channel: Answers for "Why is this null? Finding a script on an object"
Browsing all 6 articles
Browse latest View live

Answer by naqvir

It seems you cannot reference the a variable if both are not in a method. You have to do this: public var controller:GameObject; private var getEssenceHandlerComponant:Component; function Awake() {...

View Article



Answer by rutter

Did you set `controller` in the inspector? Are you sure that the component's name is spelled exactly as you have it listed? Double check that the component is attached to the object you're trying to...

View Article

Answer by Eric5h5

You should almost never use strings in GetComponent, nor should you use Component as the type. Also, stick to declaring variables only outside functions, and run code inside functions. Also, don't use...

View Article

Answer by naqvir

It seems you cannot reference the a variable if both are not in a method. You have to do this: public var controller:GameObject; private var getEssenceHandlerComponant:Component; function Awake() {...

View Article

Answer by rutter

Did you set `controller` in the inspector? Are you sure that the component's name is spelled exactly as you have it listed? Double check that the component is attached to the object you're trying to...

View Article


Answer by Eric5h5

You should almost never use strings in GetComponent, nor should you use Component as the type. Also, stick to declaring variables only outside functions, and run code inside functions. Also, don't use...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images