Hi all,
I have been having some trouble with Unity that I don’t understand. My game works in the Unity Editor using the Standalone Platform. However when I switch to iOS Platform one line of code doesn’t work.
I have Unity Pro and the Pro IOS License.
I am making a game where objects will be sent down a tunnel towards the camera. To do this I am Instantiating an Array of Objects and using “SetActiveRecursively” to turn them all off. This works Fine…
I then randomly select an Object from the Array and try to “SetActiveRecursively” However I get the
error: Assets/moveManager.js(21,40): BCE0019: ‘SetActiveRecursively’ is not a member of ‘Object’.
As I mentioned earlier the code works fine when running as a Standalone in the Unity Editor, but as soon as I switch the platform to iOS it comes with this error.
My Code Looks Like This:
var poolPoint : Transform;
var tunnelMoveArray : GameObject;
var fanCreatedArray = new Array();
function Start () {
for (var fan : GameObject in tunnelMoveArray){
var fanCreated : GameObject = Instantiate(fan, poolPoint.position, poolPoint.rotation);
fanCreated.SetActiveRecursively(false);
fanCreatedArray.Push(fanCreated);
}
}
function LeftTunnel(){
var tunnelMoveInt : int = Mathf.Abs(Random.Range(1, fanCreatedArray.length));
fanCreatedArray[tunnelMoveInt].SetActiveRecursively(true);
}
If anyone has any advice on the differences between Standalone and iOS and suggestions as to why the last line of code might not work please let me know. Also if anyone has a better way of activating/deactivating Objects from an Array that could also be a possibility.
Thanks Joe