- Home /
Question by
ina · Dec 31, 2011 at 01:57 PM ·
gameobjectinstantiatetransformparentchild
Getting instance of an sub object rather than the original's subobject
How do you reference the instance of a subobject, as opposed to the subobject in the original object?
var o:GameObject = Instantiate(growStick,coord,Quaternion.identity); var e:GameObject = o.Find("extender");
For some reason, the e reference always refers to the extender subobject in the original and not the clone.
When I try using: var e:GameObject = o.transform.Find("extender") as GameObject;
, I get "NullReferenceException: Object reference not set to an instance of an object"
Comment