OK, so I’ve spent the morning trying to work out why this works in Unity, but not in iOS. I realise iOS is typed, and looking at other examples the declaration I’m using is correct. When I run the code in iOS myController is null. Have I missed something?
var myController : SidescrollControl = this.gameObject.GetComponent(SidescrollControl);
if (myController.IsMoving())
Below is the output from xCode debug window:
(Filename: /Users/cnelson/Dropbox/Documents/2012/Unity/MobileTest02/Assets/Standard Assets (Mobile)/Scripts/PlatformerPlayerAnimation.js Line: 53)
NullReferenceException: A null value was found where an object instance was required.
at PlatformerPlayerAnimation.Update () [0x00025] in /Users/cnelson/Dropbox/Documents/2012/Unity/MobileTest02/Assets/Standard Assets (Mobile)/Scripts/PlatformerPlayerAnimation.js:61
Thanks in advance;)