Add this class to an empty object, bind a few prefabs into its RandomPool slots, and it'll instantiate one of them at its position/rotation on Start or Awake You can also call its InstantiateRandomObject method at any time, and it'll instantiate another random object on demand, potentially destroying the previous one if you decide so
More...
|
| virtual void | Awake () |
| | On awake we instantiate if needed More...
|
| |
| virtual void | Start () |
| | On Start we instantiate if needed More...
|
| |
Add this class to an empty object, bind a few prefabs into its RandomPool slots, and it'll instantiate one of them at its position/rotation on Start or Awake You can also call its InstantiateRandomObject method at any time, and it'll instantiate another random object on demand, potentially destroying the previous one if you decide so
◆ StartModes
the possible start modes
| Enumerator |
|---|
| Awake | |
| Start | |
| None | |
◆ Awake()
| virtual void MoreMountains.Tools.MMRandomInstantiator.Awake |
( |
| ) |
|
|
protectedvirtual |
On awake we instantiate if needed
◆ InstantiateRandomObject()
| virtual void MoreMountains.Tools.MMRandomInstantiator.InstantiateRandomObject |
( |
| ) |
|
|
virtual |
Spawns a random object from the pool of choices
◆ Start()
| virtual void MoreMountains.Tools.MMRandomInstantiator.Start |
( |
| ) |
|
|
protectedvirtual |
On Start we instantiate if needed
◆ _instantiatedGameObject
| GameObject MoreMountains.Tools.MMRandomInstantiator._instantiatedGameObject |
|
protected |
◆ DestroyPreviouslyInstantiatedObject
| bool MoreMountains.Tools.MMRandomInstantiator.DestroyPreviouslyInstantiatedObject = true |
if this is true, every time InstantiateRandomObject is called, any previously instantiated object will be destroyed
◆ InstantiateButton
| bool MoreMountains.Tools.MMRandomInstantiator.InstantiateButton |
a test button for your inspector
◆ InstantiatedObjectName
| string MoreMountains.Tools.MMRandomInstantiator.InstantiatedObjectName = "RandomInstantiated" |
the name to give to the instantiated object
◆ ParentInstantiatedToThisObject
| bool MoreMountains.Tools.MMRandomInstantiator.ParentInstantiatedToThisObject = true |
if this is true, the instantiated object will be parented to the spawner
◆ RandomPool
| List<GameObject> MoreMountains.Tools.MMRandomInstantiator.RandomPool |
the list containing all the objects that can potentially be instantiated
◆ StartMode
whether this instantiator should auto trigger on Awake, Start, or never
The documentation for this class was generated from the following file: