Greetings;
In C#, I have the following script:
TweenRotation _tweenRotation;
void Start() {
_tweenRotation = GetComponent<TweenRotation>();
if (_tweenRotation == null) {
print ("can't find _tweenRotation");
}
}
void OnClick_btnSettings(){
// this works just fine
_tweenRotation.enabled = true;
}
This returns null. However, I can access the script just fine. The documentation from the following URL states this:
“function GetComponent (type : Type) :
Component Description Returns the
component of Type type if the game
object has one attached, null if it
doesn’t. You can access both builtin
components or scripts with this
function.”
Why is the object comparable to null if the object is valid and I can access the object just fine from within code?