Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

gameobject parent unity3d

public GameObject Child;
public Transform NewParent;

// Sets "newParent" as the new parent of the child GameObject.
Child.transform.SetParent(NewParent);

// Removes parent, puts child into a top-level object in the hierarchy
Child.transform.SetParent(null);
 
PREVIOUS NEXT
Tagged: #gameobject #parent
ADD COMMENT
Topic
Name
1+6 =