Faisalmirza Mirza
Faisalmirza Mirza

Reputation: 47

Instantiate object is not displayed in hierarchy

I have try to instantiate a prefab as a child of other object,but the problem is that the object is not displayed in hierarchy. The print statement work fine but object is not display in hierarchy.

GameObject k = Instantiate (Knives [0].knife, Knives [0].position, 
                                  Quaternion.identity) as GameObject;   

k.transform.SetParent(LogRotation.Instance.LogmoterChild.transform);

if (k) {
    print ("parents" + k.name);
    print ("pos  "+k.transform.position);
}

Upvotes: 0

Views: 400

Answers (1)

Sami Siddiqui
Sami Siddiqui

Reputation: 9

Please see the overload

public static Object Instantiate(Object original, Vector3 position, Quaternion rotation, Transform parent);

Upvotes: 1

Related Questions