Class ScenarioBase | Perception | 0.5.0-preview.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class ScenarioBase

    Derive ScenarioBase to implement a custom scenario

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    ScenarioBase
    Scenario<T>
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Experimental.Perception.Randomization.Scenarios
    Syntax
    [DefaultExecutionOrder(-1)]
    public abstract class ScenarioBase : MonoBehaviour

    Fields

    quitOnComplete

    If true, this scenario will quit the Unity application when it's finished executing

    Declaration
    [HideInInspector]
    public bool quitOnComplete
    Field Value
    Type Description
    Boolean

    serializedConstantsFileName

    The name of the Json file this scenario's constants are serialized to/from.

    Declaration
    [HideInInspector]
    public string serializedConstantsFileName
    Field Value
    Type Description
    String

    Properties

    activeScenario

    Returns the active parameter scenario in the scene

    Declaration
    public static ScenarioBase activeScenario { get; }
    Property Value
    Type Description
    ScenarioBase

    currentIteration

    The current iteration index of the scenario

    Declaration
    public int currentIteration { get; protected set; }
    Property Value
    Type Description
    Int32

    currentIterationFrame

    The number of frames that have elapsed since the current scenario iteration was Setup

    Declaration
    public int currentIterationFrame { get; }
    Property Value
    Type Description
    Int32

    framesSinceInitialization

    The number of frames that have elapsed since the scenario was initialized

    Declaration
    public int framesSinceInitialization { get; }
    Property Value
    Type Description
    Int32

    genericConstants

    Returns this scenario's non-typed serialized constants

    Declaration
    public abstract object genericConstants { get; }
    Property Value
    Type Description
    Object

    isIterationComplete

    Returns whether the current scenario iteration has completed

    Declaration
    public abstract bool isIterationComplete { get; }
    Property Value
    Type Description
    Boolean

    isScenarioComplete

    Returns whether the entire scenario has completed

    Declaration
    public abstract bool isScenarioComplete { get; }
    Property Value
    Type Description
    Boolean

    randomizers

    Return the list of randomizers attached to this scenario

    Declaration
    public IReadOnlyList<Randomizer> randomizers { get; }
    Property Value
    Type Description
    IReadOnlyList<Randomizer>

    serializedConstantsFilePath

    Returns the file location of the JSON serialized constants

    Declaration
    public string serializedConstantsFilePath { get; }
    Property Value
    Type Description
    String

    tagManager

    The RandomizerTagManager attached to this scenario

    Declaration
    public RandomizerTagManager tagManager { get; }
    Property Value
    Type Description
    RandomizerTagManager

    Methods

    CreateRandomizer<T>()

    Creates a new randomizer and adds it to this scenario

    Declaration
    public T CreateRandomizer<T>()
        where T : Randomizer, new()
    Returns
    Type Description
    T

    The newly created randomizer

    Type Parameters
    Name Description
    T

    The type of randomizer to create

    Deserialize()

    Deserializes constants saved in a JSON file located at serializedConstantsFilePath

    Declaration
    public abstract void Deserialize()

    GenerateIterativeRandomSeed(Int32, UInt32)

    Generates a random seed by hashing three values together: an arbitrary iteration value, the current scenario iteration, and a base random seed

    Declaration
    public uint GenerateIterativeRandomSeed(int iteration, uint baseSeed = 539662031U)
    Parameters
    Type Name Description
    Int32 iteration

    An offset value hashed inside the seed generator

    UInt32 baseSeed

    An offset value hashed inside the seed generator

    Returns
    Type Description
    UInt32

    The generated random seed

    GenerateRandomSeed(UInt32)

    Generates a random seed by hashing the current scenario iteration with a given base random seed

    Declaration
    public uint GenerateRandomSeed(uint baseSeed = 539662031U)
    Parameters
    Type Name Description
    UInt32 baseSeed

    Used to offset the seed generator

    Returns
    Type Description
    UInt32

    The generated random seed

    GetRandomizer<T>()

    Finds and returns a randomizer attached to this scenario of the specified Randomizer type

    Declaration
    public T GetRandomizer<T>()
        where T : Randomizer
    Returns
    Type Description
    T

    A randomizer of the specified type

    Type Parameters
    Name Description
    T

    The type of randomizer to find

    Exceptions
    Type Condition
    UnityEngine.Experimental.Perception.Randomization.Scenarios.ScenarioException

    GetRandomizerIndex<T>()

    Returns the execution order index of a randomizer of the given type

    Declaration
    public int GetRandomizerIndex<T>()
        where T : Randomizer, new()
    Returns
    Type Description
    Int32

    The randomizer index

    Type Parameters
    Name Description
    T

    The type of randomizer to index

    Exceptions
    Type Condition
    UnityEngine.Experimental.Perception.Randomization.Scenarios.ScenarioException

    IncrementIteration()

    Progresses the current scenario iteration

    Declaration
    protected virtual void IncrementIteration()

    OnAwake()

    This method executed directly after this scenario has been registered and initialized

    Declaration
    protected virtual void OnAwake()

    RemoveRandomizer<T>()

    Removes a randomizer of the specified type from this scenario

    Declaration
    public void RemoveRandomizer<T>()
        where T : Randomizer, new()
    Type Parameters
    Name Description
    T

    The type of scenario to remove

    ReorderRandomizer(Int32, Int32)

    Moves a randomizer from one index to another

    Declaration
    public void ReorderRandomizer(int currentIndex, int nextIndex)
    Parameters
    Type Name Description
    Int32 currentIndex

    The index of the randomizer to move

    Int32 nextIndex

    The index to move the randomizer to

    Serialize()

    Serializes the scenario's constants to a JSON file located at serializedConstantsFilePath

    Declaration
    public abstract void Serialize()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023