Method Instantiate
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
Instantiate<T>(T)
Instantiates the specified prefab.
public static T Instantiate<T>(T prefab) where T : Component
Parameters
prefabTThe object.
Returns
- T
T.
Type Parameters
T
Instantiate<T>(T, Vector3, Quaternion)
Instantiates an object at the given position in the given orientation.
public static T Instantiate<T>(T prefab, Vector3 position, Quaternion rotation) where T : Component
Parameters
prefabTThe prefab to instantiate.
positionVector3The position.
rotationQuaternionThe rotation.
Returns
- T
T.
Type Parameters
T
Instantiate<T>(T, GameObject)
Instantiates a prefab and attaches it to the given root.
public static T Instantiate<T>(T prefab, GameObject root) where T : Component
Parameters
prefabTThe prefab to instantiate.
rootGameObjectThe parent GameObject to attach the instance to.
Returns
- T
The instantiated component.
Type Parameters
TThe component type on the prefab.
Instantiate<T>(T, GameObject, Vector3, Quaternion)
Instantiates a prefab, attaches it to the given root, and sets the local position and rotation.
public static T Instantiate<T>(T prefab, GameObject root, Vector3 localPosition, Quaternion localRotation) where T : Component
Parameters
prefabTThe prefab to instantiate.
rootGameObjectThe parent GameObject to attach the instance to.
localPositionVector3The local position to set on the instance.
localRotationQuaternionThe local rotation to set on the instance.
Returns
- T
The instantiated component.
Type Parameters
TThe component type on the prefab.
Instantiate(GameObject)
Instantiates a prefab.
public static GameObject Instantiate(GameObject prefab)
Parameters
prefabGameObjectThe object.
Returns
- GameObject
GameObject.
Instantiate(GameObject, Vector3, Quaternion)
Instantiates the specified prefab at the given position and rotation.
public static GameObject Instantiate(GameObject prefab, Vector3 position, Quaternion rotation)
Parameters
prefabGameObjectThe prefab to instantiate.
positionVector3The world position for the new instance.
rotationQuaternionThe world rotation for the new instance.
Returns
- GameObject
The instantiated GameObject.
Instantiate(GameObject, GameObject)
Instantiates a prefab and parents it to the root.
public static GameObject Instantiate(GameObject prefab, GameObject root)
Parameters
prefabGameObjectThe prefab.
rootGameObjectThe root.
Returns
- GameObject
GameObject.
Instantiate(GameObject, GameObject, Vector3, Quaternion)
Instantiates a prefab, attaches it to the given root, and sets the local position and rotation.
public static GameObject Instantiate(GameObject prefab, GameObject root, Vector3 localPosition, Quaternion localRotation)
Parameters
prefabGameObjectThe prefab.
rootGameObjectThe root.
localPositionVector3The local position.
localRotationQuaternionThe local rotation.
Returns
- GameObject
GameObject.