unity3d - Can I know in Unity 5 who Instantiated the object? -


is possible information instantiated object 1 instantiated it?

for example let's have objecta:

instantiate(objectb, gameobject.transform.position, quaternion.identity); 

is there way in objectb:

awake() { var vector = parent.transform.position }; 

where "parent" initiator.

you can following accomplish that:

// in objecta class's function gameobject objb = instantiate(objectb, gameobject.transform.position, quaternion.identity); objb.parentpos = transform.position; // , if want know instantiated it, use line: objb.parentgameobj = gameobject;  // in objectb class public vector3 parentpos; public gameobject parentgameobj; 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -