| UnityUtilsAddChild Method |
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.DataBind.Core.Utils
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax public static GameObject AddChild(
this GameObject parent,
GameObject prefab,
bool resetScale = true
)
<ExtensionAttribute>
Public Shared Function AddChild (
parent As GameObject,
prefab As GameObject,
Optional resetScale As Boolean = true
) As GameObject
public:
[ExtensionAttribute]
static GameObject^ AddChild(
GameObject^ parent,
GameObject^ prefab,
bool resetScale = true
)
[<ExtensionAttribute>]
static member AddChild :
parent : GameObject *
prefab : GameObject *
?resetScale : bool
(* Defaults:
let _resetScale = defaultArg resetScale true
*)
-> GameObject
Parameters
- parent
- Type: UnityEngineGameObject
Game object to add child to. - prefab
- Type: UnityEngineGameObject
Prefab to instantiate new child from. - resetScale (Optional)
- Type: SystemBoolean
If the scale of the child is reset.
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