Interface Trait | Kinematica | 0.6.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Interface Trait

    Interface for traits.

    Namespace: Unity.Kinematica
    Syntax
    public interface Trait
    Remarks

    Traits are user-defined characteristics that can be associated to tags or markers. Users can define own custom data by using C# structs. These structs will then show up in the Kinematica builder tool and allow tags or markers to be created carrying specific instances of the corresponding traits. A trait itself wraps the actual payload (the instance of the user-defined struct).

    Traits can optionally implement the trait interface which allows to execute code whenever a marker referring to the trait is "stepped over" during playback.

    [Trait, BurstCompile]
    public struct Loop : Trait
    {
        public void Execute(ref MotionSynthesizer synthesizer)
        {
            synthesizer.Push(synthesizer.Rewind(synthesizer.Time));
        }
    
        [BurstCompile]
        public static void ExecuteSelf(ref Loop self, ref MotionSynthesizer synthesizer)
        {
            self.Execute(ref synthesizer);
        }
    }

    Methods

    Execute(ref MotionSynthesizer)

    Method that is to be executed if a marker that carries this trait is encountered during playback.

    Declaration
    void Execute(ref MotionSynthesizer synthesizer)
    Parameters
    Type Name Description
    MotionSynthesizer synthesizer

    See Also

    Binary.Tag
    Binary.Marker
    Query
    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