Search Unity

Question Select elements programmatically in editor

Discussion in 'Scripting' started by topofsteel, Mar 24, 2021.

  1. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Is it possible to select elements in the editor similar to runtime with GetComponentsInChildren<>? I need to change the common properties of a lot of UI elements. Thank you
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,726
    Sorta... it's more like FindObjectsOfType<T>() than GetComponentsInChildren<T>() though.

    In the search field type
    t:MyScriptClassName


    Then you can Ctrl-A all GameObjects, and over in the inspector be able to edit the common Component.

    In other extremely useful news, you can open more than one inspector window, and then you can actually lock one window (upper right corner) and use the other one to find other stuff.

    Don't forget to unlock it when you're done. That's always ... baffling.