Skip to main content

Instantiator

A class in Root.Township, the global namespace.

Spawns a local, non-networked copy of a prefab at a target transform when InstantiatePrefab is called, for example from a Unity event.

Constructors​

MemberWhat it is
Instantiator()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private GameObject prefabThe object to copy.
private Transform targetOrientationWhere the copy is placed and how it is rotated and scaled.
private Transform targetParentParent for the copy. Can be null.

Methods​

MemberWhat it is
void InstantiatePrefab()Instantiates the prefab with the target's position, rotation and local scale, then parents it to targetParent.
1 private and internal method
MemberWhat it is
private void Awake()Uses this object's transform when no target orientation is set.