Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to Highlight an element in List as SerializedProperty at Inspector?

Discussion in 'Editor & General Support' started by Ozgekocaoglu, Mar 28, 2022.

  1. Ozgekocaoglu

    Ozgekocaoglu

    Joined:
    Feb 13, 2019
    Posts:
    38
    Hi everyone,
    I'm trying to use Highlighter.Highlight() method but it does not work for SeriliazedProperty. I saw that line in doc.

    ''Any control that uses the SerializedProperty system can be highlighted using its SerializedProperty.propertyPath.''

    It didn't work. Actual problem is my property is a list so i need to highlight an element from list. How could i do that without using reorderable list?
     
    nickeron likes this.
  2. nickeron

    nickeron

    Joined:
    Jun 20, 2018
    Posts:
    3
    Hi! I was looking for this exact thing. Did you find anything?
     
  3. Ozgekocaoglu

    Ozgekocaoglu

    Joined:
    Feb 13, 2019
    Posts:
    38
    Actually, i use reorderable list

    Like this:

    Code (CSharp):
    1.  
    2. ReorderableList list;
    3.  
    4. public void init()
    5. {
    6.    list.drawElementCallback += (rect, index, active, focused) => {
    7.         GUI.SetNextControlName(index.ToString());
    8.         if (focused) {
    9.           GUI.FocusControl(index.ToString());
    10.         }
    11.       };
    12. }
     
    Last edited: Nov 28, 2022