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

◆ GameObject() [8/25]

Sisus.Init.GameObject< TComponent >.GameObject ( Transform parent,
Vector3 position,
Quaternion rotation,
bool inWorldSpace = false,
bool active = true )

Starts the process of creating a new GameObject with a component of type TComponent .

The component must be initialized by calling an Init function with arguments matching the argument list defined by the IArgs interface that TComponent implements.

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

The new GameObject is always first created in an inactive state and only activated once the component has been initialized and only if active is set to true. 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
parentThe parent of the created GameObject.
positionThe position for the new GameObject.
rotationThe orientation of the new GameObject.
inWorldSpacetrue to set the position and rotation for the new GameObject directly in world space or false to set them relative to the GameObject's new parent .
activeDefines whether the created GameObject is active in the Scene.