Right. Im running into some weird issue with android unity. I have this bit of code
function OnTriggerStay (other : Collider)
{
if(die.GetComponent(DieScript).sideUp ==6 ||die.GetComponent(DieScript).sideUp ==2 || die.GetComponent(DieScript).sideUp ==4)
{
parSys.startSpeed = -5;
if (other.attachedRigidbody)
{
var direction = -(other.attachedRigidbody.transform.position - transform.position*1.5);
other.attachedRigidbody.AddForce(direction);
}
}
Now, this runs fine in the unity editor. More then fine, It runs perfectly. However on android the whole OnTriggerStay method fails, and I get this error from logcat
I/Unity (29199): NullReferenceException: Object reference not set to an instance of an object
I/Unity (29199): at ZoneScriptDie.OnTriggerStay (UnityEngine.Collider other) [0x00000] in <filename unknown>:0
I/Unity (29199):
I/Unity (29199): (Filename: Line: -1)
I/Unity (29199):
I/Unity (29199): NullReferenceException: Object reference not set to an instance of an object
I/Unity (29199): at ZoneScriptDie.OnTriggerStay (UnityEngine.Collider other) [0x00000] in <filename unknown>:0
I/Unity (29199):
Why is it failing in android? The whole object freezes up, the particles just hang in place like a frozen snowglobe.
die
may be the object that doesn't have a reference. – chaosTechnician Dec 29 '12 at 6:16parSys = GetComponent(ParticleSystem); die = GameObject.Find("die");
So It should exist. It exists and runs fine in the editor, but not on android. Ill try playing with how it finds the object – ProtoJazz Dec 29 '12 at 6:35