Reputation: 47
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
Reputation: 9
Please see the overload
public static Object Instantiate(Object original, Vector3 position, Quaternion rotation, Transform parent);
Upvotes: 1