In its most basic form I am trying to make it so that whenever the user pushes a 3d button the explosion from the startrooper example is rendered. I do this with the following script, named click, which is attached to the button. Also the explosion is connected from my assets (its not in the scene yet).
Click.js:
var explosion: GameObject;
public var excellentLoc: GameObject;
function Update () {
if (Input.GetMouseButtonDown (0)) {
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit: RaycastHit;
if (collider.Raycast (ray, hit, 100)) {
Instantiate(explosion,excellentLoc.transform.position,excellentLoc.transform.rotation);
}
}
}
Now when I do this on the computer, no problem works as expected, however when I do it on the iPhone xCode throws the following
NullReferenceException occured in:
IP 0x727868 at offset 0x1c8 of method Click:Update () (0x7276a0 0x727954)[domain 0x1509e70 - UnityDomainLoad.exe]
I have made it so there is nothing in my scene except the button and the explosion, just to see if it was a memory issue, however still the same results. Why can I instantiate the explosion on the computer but not the iPhone? It works fine in the StarTrooper Demo on the phone.