Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMRandomInstantiator Class Reference

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...

Inheritance diagram for MoreMountains.Tools.MMRandomInstantiator:

Public Types

enum  StartModes { StartModes.Awake, StartModes.Start, StartModes.None }
 the possible start modes More...
 

Public Member Functions

virtual void InstantiateRandomObject ()
 Spawns a random object from the pool of choices More...
 

Public Attributes

StartModes StartMode = StartModes.Awake
 whether this instantiator should auto trigger on Awake, Start, or never More...
 
string InstantiatedObjectName = "RandomInstantiated"
 the name to give to the instantiated object More...
 
bool ParentInstantiatedToThisObject = true
 if this is true, the instantiated object will be parented to the spawner More...
 
bool DestroyPreviouslyInstantiatedObject = true
 if this is true, every time InstantiateRandomObject is called, any previously instantiated object will be destroyed More...
 
List< GameObject > RandomPool
 the list containing all the objects that can potentially be instantiated More...
 
bool InstantiateButton
 a test button for your inspector More...
 

Protected Member Functions

virtual void Awake ()
 On awake we instantiate if needed More...
 
virtual void Start ()
 On Start we instantiate if needed More...
 

Protected Attributes

GameObject _instantiatedGameObject
 

Detailed Description

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

Member Enumeration Documentation

◆ StartModes

the possible start modes

Enumerator
Awake 
Start 
None 

Member Function Documentation

◆ 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

Member Data Documentation

◆ _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

StartModes MoreMountains.Tools.MMRandomInstantiator.StartMode = StartModes.Awake

whether this instantiator should auto trigger on Awake, Start, or never


The documentation for this class was generated from the following file: