Click or drag to resize
UnityGameObjectUtilsAddChild Method (GameObject, GameObject)
Instantiates a new game object from the specified prefab and adds it to the game object. Makes sure the position/rotation/scale are initialized correctly.

Namespace: Slash.Unity.Common.Utils
Assembly: Slash.Unity.Common (in Slash.Unity.Common.dll) Version: 1.0.6018.40182
Syntax
public static GameObject AddChild(
	this GameObject parent,
	GameObject prefab
)

Parameters

parent
Type: GameObject
Game object to add child to.
prefab
Type: GameObject
Prefab to instantiate new child from.

Return Value

Type: GameObject
Instantiated new child.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type GameObject. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also