 | UnityGameObjectUtilsAddChild Method (GameObject, String) |
Instantiates a new game object with the specified name and adds it
to the game object.
Makes sure the position/rotation/scale are initialized correctly.
Namespace: Slash.Unity.Common.UtilsAssembly: Slash.Unity.Common (in Slash.Unity.Common.dll) Version: 1.0.6018.40182
Syntaxpublic static GameObject AddChild(
this GameObject parent,
string name
)
<ExtensionAttribute>
Public Shared Function AddChild (
parent As GameObject,
name As String
) As GameObject
public:
[ExtensionAttribute]
static GameObject^ AddChild(
GameObject^ parent,
String^ name
)
[<ExtensionAttribute>]
static member AddChild :
parent : GameObject *
name : string -> GameObject
Parameters
- parent
- Type: GameObject
Game object to add child to. - name
- Type: SystemString
Name of the new child.
Return Value
Type:
GameObjectInstantiated 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