Init(args)
Scripting Reference
Loading...
Searching...
No Matches

◆ GameObject() [16/24]

Sisus.Init.GameObject< TFirstComponent, TSecondComponent, TThirdComponent >.GameObject ( [DisallowNull] GameObject original,
Transform parent,
Vector3 position,
bool positionInWorldSpace,
bool active )

Starts the process of cloning the original GameObject with a component of type TFirstComponent , TSecondComponent and TThirdComponent .

The components must be initialized by first calling an Init1 function with arguments matching the argument list defined by the IArgs interface that TFirstComponent implements and then calling an Init2 function with arguments matching the argument list defined by the IArgs interface that TSecondComponent implements and then calling an Init3 function with arguments matching the argument list defined by the IArgs interface that TThirdComponent implements.

If TComponent does not implement any IArgs interface then the parameterless Init function should be used.

The new GameObject is first created in an inactive state and only activated once the component has been initialized. This ensures that the Awake and OnEnable event functions for the component are only called after the component has been initialized with its dependencies.

Parameters
originalAn existing object that you want to make a copy of.
parentThe parent of the created GameObject.
positionThe position for the new GameObject.
positionInWorldSpacetrue to position the new GameObject directly in world space or false to set the GameObject's position relative to its new parent .
activeDefines whether the created GameObject is active in the Scene.