- Home /
 
               Question by 
               Catlard · Aug 30, 2011 at 04:34 AM · 
                nullreferenceexceptionitweeninstantiation  
              
 
              Using iTween with a prefab tree.
Howdy.
Does iTween not work on instantiations?
I'm getting three NullReferenceException errors per frame pointing to the iTween.cs script. It happens when I attempt to use iTween.ScaleTo on an instantiation of a tree object. I want the tree to "grow" when it is created, so I've got the script below on my tree prefab. It's working on the original copy of the tree, but not on the instantiated version. When I run it, the print statement in the second function (the one the iTween calls) appears correctly, but the tree doesn't scale up, and I get even more errors! Here's the script that's causing an error. Thanks in advance for your time!
--Simon
  var isScaled = false;
 
 function Update ()
 {
     if(!isScaled)
     {
         iTween.ScaleTo(gameObject, {"scale" : Vector3(.5,.5,.5), "time" : 1f, "easetype" : "easeInOutCubic", "oncomplete" : "treeGrown"});
         isScaled = true;
     }
 }
 
 function treeGrown ()
 {
     print("All Finished!");
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                