Search Unity

Question Animation Rigging Rig Effectors

Discussion in 'Animation Rigging' started by TheM7, Jun 4, 2022.

  1. TheM7

    TheM7

    Joined:
    May 29, 2019
    Posts:
    2
    Hi, is there a way to turn on and off Rig Effectors gizmos on the scene view, the same way you can show and hide all gizmos?
     
  2. CampbellSFletcher

    CampbellSFletcher

    Joined:
    Jul 30, 2021
    Posts:
    3
    i was confused about this for so long, but you can press the "eye" icon in the hierarchy view and hide them this way. It's not always ideal but I've come to appreciate the extra control it gives
     
    sickshredzz and TheM7 like this.
  3. TheM7

    TheM7

    Joined:
    May 29, 2019
    Posts:
    2
    Thank you, I forgot about that. And for me it's more than enough.
     
  4. ZedPo

    ZedPo

    Joined:
    Nov 27, 2018
    Posts:
    13
    I'd love to follow up on this.

    Because I have a scene with hundreds of effectors and would love a simple toggle to turn them all on/off. I built a editor script to hide all the bone renderers simply enough, but the effectors don't have a component added to their gameobjects that would make them easily findable in code... Any help would be great!
     
  5. ZedPo

    ZedPo

    Joined:
    Nov 27, 2018
    Posts:
    13
    Adding a photo to help out. Specifically looking for a way to toggle this highlighted checkbox on ALL "effectors" in a scene.
     

    Attached Files:

  6. ZedPo

    ZedPo

    Joined:
    Nov 27, 2018
    Posts:
    13
    Probably should have waited before posting this... because I figured it out! Here's the code in case anyone in the future needs this. (Includes the Bone Hide function as well)

    Code (CSharp):
    1.  
    2. using UnityEditor;
    3. using UnityEngine.Animations.Rigging;
    4. using UnityEditor.SceneManagement;
    5.  
    6. public class BoneHider : ScriptableWizard
    7. {
    8.     [MenuItem("Animation Rigging/Toggle Bones")]
    9.     public static void ToggleBones()
    10.     {
    11.         BoneRenderer[] bones = FindObjectsOfType<BoneRenderer>();
    12.         foreach (var bone in bones)
    13.         {
    14.             bone.enabled = !bone.enabled;
    15.         }
    16.         EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
    17.     }
    18.  
    19.     [MenuItem("Animation Rigging/Toggle Effectors")]
    20.     public static void ToggleEffectors()
    21.     {
    22.         Rig[] rigs = FindObjectsOfType<Rig>();
    23.         foreach (var rig in rigs)
    24.         {
    25.             var enumerator = rig.effectors.GetEnumerator();
    26.             while (enumerator.MoveNext())
    27.             {
    28.                 enumerator.Current.visible = !enumerator.Current.visible;
    29.             }
    30.         }
    31.         EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
    32.     }
    33. }
    34.  
     
    mhrbay, LaserRock and sickshredzz like this.