Hey!
I’ve got this script that is on an object I’m instantiating. It’s got six children, which I’m fading via iTween, in a certain order, as per the script fragment below. It works just fine on the original object, when I’m not instantiating anything. But when I instantiate the object, the iTween argument for the object to be faded throws a nullreferenceexception error. I know it has to do with the object that it’s attempting to tween because I’ve changed that to something that’s not an instantiation, and it fixes the error. I have no idea why… can you explain it? It’s telling me that the object I’m trying to tween is null, when I have it print that object.
Here’s the iTween call:
iTween.FadeTo(flameArray[activeFlame], {"alpha" : 0, "time" : timeToFadeOut, "easetype" : "easeInOutQuad", "oncomplete" : "flameGenerator", "oncompletetarget" : gameObject});
And here’s how I’m determining the object, in the “Start” function:
function Start ()
{
flameArray = new Array(transform.Find("z_backgroundFire1").gameObject,
transform.Find("z_backgroundFire2").gameObject,
transform.Find("z_backgroundFire3").gameObject,
transform.Find("z_backgroundFire4").gameObject,
transform.Find("z_backgroundFire5").gameObject,
transform.Find("z_backgroundFire6").gameObject);
print(flameArray);
print(transform.Find("z_backgroundFire1"));
for(var i=0; i<flameArray.length; i++)
{
flameArray*.renderer.material.SetColor ("_Color", clearWhiteColor );*
- }*
- flameGenerator();*
}