displaying list with blocked elements

Hello, I am displaying a list with CustomEditor and I want to block some elements, as the image shows. How can I make this?

Good question… I think it might be handled by a different GUIStyle perhaps???

Or else perhaps they have made a custom property inspector for whatever is the “line vs value” entry above is stored as?

Unity - Scripting API: EditorGUI.BeginDisabledGroup and Unity - Scripting API: EditorGUI.EndDisabledGroup

This does require you to be handle full drawing of the collection, which is beyond my expertise.

2 Likes

thanks, this is the solution

for (int i = 0; i < tags.Basics.Count; i++)
{
   var tag = tags.Basics[i];
   EditorGUILayout.SelectableLabel(tag, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
}

After:

for (int i = 0; i < tags.Basics.Count; i++)
{
   var tag = tags.Basics[i];
   EditorGUI.BeginDisabledGroup(true);
   EditorGUILayout.SelectableLabel(tag, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
   EditorGUI.EndDisabledGroup();
}
1 Like