Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Resolved How to turn off the GUI animation

Discussion in '2019.3 Beta' started by laurentlavigne, Sep 1, 2019.

  1. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,335
    Not fond of animation when you expand a hierarchy?
    Got you covered!

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEditorInternal;
    3. using UnityEngine;
    4.  
    5. static class TreeViewToggleAnimation
    6. {
    7.     [MenuItem("TreeViewUtility/Toggle Animation")]
    8.     static void ToggleAnimation()
    9.     {
    10.         const string prefKey = "TreeViewExpansionAnimation";
    11.         bool newValue = !EditorPrefs.GetBool(prefKey, true);
    12.         EditorPrefs.SetBool(prefKey, newValue);
    13.         EditorUtility.RequestScriptReload();
    14.         Debug.Log("TreeView animation is now " + (newValue ? "enabled" : "disabled"));
    15.     }
    16. }
    17.