StateVisualizer Class

Definition

The State Visualizer component adds animations to an object based on the states defined in a linked Interactive Element component. This component creates animation assets, places them in the MixedRealityToolkit.Generated folder and enables simplified animation keyframe setting through adding animatable properties to a target game object. To enable animation transitions between states, an Animator Controller asset is created and a default state machine is generated with associated parameters and transitions. This state machine can be viewed in Unity's Animator window.

C++
public ref class StateVisualizer : UnityEngine::MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
StateVisualizer
Attributes
UnityEngine.RequireComponentAttribute

Constructors

Fields

Properties

Animator

The Animator for this State Visualizer component. The State Visualizer component leverages the capabilities of the Unity animation system and requires the presence of an Animator component.

InteractiveElement

The linked Interactive Element component for this State Visualizer. The State Visualizer component depends on the presence of a component that derives from BaseInteractiveElement.

StateContainers

A list of containers that map to the states in the attached Interactive Element component.

States

Methods

AddAnimatableProperty(String, Int32, AnimatableProperty)

Add an animatable property to an animation target in a state container.

AddAnimationTargetToState(String, GameObject)

Add an animation target to a state container. An animation target contains a reference to the target game object and a list of the animatable properties associated with the target.

GetAnimatableProperty<T>(String, Int32)

Get an animatable property by type.

GetAnimatorState(String)

Get an animator state in the animator state machine by state name.

GetShaderAnimatablePropertyList<T>(String, Int32)

Get a list of the shader animatable properties by type.

GetStateContainer(String)

Get state container given a state name.

RemoveKeyFrames(String, Int32, String)

Remove previously set keyframes.

SetAnimationClip(String, AnimationClip)

Set the animation clip for a state.

SetAnimationTransitionDuration(String, Single)

Set the AnimationTransitionDuration for a state.

SetKeyFrames(String, Int32)

Set the keyframes for a given animatable property.

SetUpStateMachine(AnimatorController)

Initialize the Animator State Machine by creating new animator states to match the states in Interactive Element.

Applies to

Produkt Wersje
MRTK2 Unity 2019 2.6.0, 2.7.0, 2.8.0
MRTK2 Unity 2020 2.6.0, 2.7.0, 2.8.0