Class Randomizer
Derive Randomizer to implement systems that randomize GameObjects and/or simulation properties.
Inherited Members
Namespace: UnityEngine.Perception.Randomization.Randomizers
Assembly: Unity.Perception.Runtime.dll
Syntax
[Serializable]
public abstract class Randomizer
Properties
enabled
Enabled Randomizers are updated, disabled Randomizers are not.
Declaration
public bool enabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
enabledStateCanBeSwitchedByUser
Some Randomizers should not be disabled by the user as they are critical to the project. E.g. We might want to mark this as false for a foreground objects placement randomizer in some projects
Declaration
public bool enabledStateCanBeSwitchedByUser { get; set; }
Property Value
Type | Description |
---|---|
bool |
scenario
Returns the scenario containing this Randomizer
Declaration
public ScenarioBase scenario { get; }
Property Value
Type | Description |
---|---|
ScenarioBase |
tagManager
Retrieves the RandomizerTagManager of the scenario containing this Randomizer
Declaration
public RandomizerTagManager tagManager { get; }
Property Value
Type | Description |
---|---|
RandomizerTagManager |
Methods
OnAwake()
OnAwake is called when the Randomizer is added or loaded to a scenario
Declaration
protected virtual void OnAwake()
OnCreate()
OnCreate is called when the Randomizer is added or loaded to a scenario
Declaration
[Obsolete("Method OnCreate has been deprecated. Use OnAwake instead (UnityUpgradable)", true)]
protected virtual void OnCreate()
OnDestroy()
OnDestroy is called at once Scenario is destroyed
Declaration
protected virtual void OnDestroy()
OnDisable()
OnDisable is called when the Randomizer becomes disabled
Declaration
protected virtual void OnDisable()
OnEnable()
OnEnabled is called when the Randomizer becomes enabled and active
Declaration
protected virtual void OnEnable()
OnIterationEnd()
OnIterationEnd is called the after a Scenario iteration has completed
Declaration
protected virtual void OnIterationEnd()
OnIterationStart()
OnIterationStart is called at the start of a new Scenario iteration
Declaration
protected virtual void OnIterationStart()
OnScenarioComplete()
OnScenarioComplete is called the after the entire Scenario has completed
Declaration
protected virtual void OnScenarioComplete()
OnScenarioStart()
OnScenarioStart is called on the frame the scenario begins iterating
Declaration
protected virtual void OnScenarioStart()
OnStartRunning()
OnStartRunning is called on the first frame a Randomizer is enabled
Declaration
[Obsolete("Method OnStartRunning has been deprecated. Use OnEnabled instead (UnityUpgradable)", true)]
protected virtual void OnStartRunning()
OnStopRunning()
OnStartRunning is called on the first frame a disabled Randomizer is updated
Declaration
[Obsolete("Method OnStopRunning has been deprecated. Use OnDisable instead (UnityUpgradable)", true)]
protected virtual void OnStopRunning()
OnUpdate()
OnUpdate is executed every frame for enabled Randomizers
Declaration
protected virtual void OnUpdate()
Query<T>()
Enumerates over all RandomizerTags of the given type present in the scene
Declaration
public IEnumerable<T> Query<T>() where T : RandomizerTag
Returns
Type | Description |
---|---|
IEnumerable<T> | RandomizerTags of the given type |
Type Parameters
Name | Description |
---|---|
T | The type of RandomizerTag to query for |