Unity Forge Property Drawers

by rfadeev

Custom propery drawers to ease fields value management in Unity editor

( Crawled 10 minutes ago )
+

animator-state-property-drawer License

Custom propery drawer to ease animator state name selection in Unity editor.

screencast

How to use

Import UnityForge namespace and mark animator state name field with AnimatorStateName attribute. After that you will be able to select animator state name value from dropdown list in Unity editor.

using UnityEngine;
using UnityForge;

public class AnimatorStateNameExample : MonoBehaviour
{
    [SerializeField, AnimatorStateName]
    private string stateName;

    private void Start()
    {
        var animator = GetComponent<Animator>();
        animator.Play(stateName);
    }
}

Currently property attribute works only for Animator component attached to the same game object.

Caveats

Since layer index is decoupled from animator state name in Unity API, state name alone does not determine state and state index value should be managed separately. If only one animation layer is used, it's not the problem and Play(string stateName) overload can be used safely for fields using AnimatorStateName attribute.