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

◆ GameObject() [16/25]

Sisus.Init.GameObject< TComponent >.GameObject ( [DisallowNull] GameObject original,
Transform parent )

Starts the process of cloning the original 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 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.