Neutral state for toggle buttons?

Hello,

I’m trying to make a toggle button in my EditorWindow displaying multiple bool value, so I need a neutral state for the button, like this

36482-untitled.png

But it seems there is no choice for neutral state.

Thanks

The sign inside that toggle means that you have 2 or more objects selected which have different values for the same boolean. To display this sign, you would need to set EditorGUI.showMixedValue to true before you call EditorGUI.Toggle (And probably set it to false afterwards)

If you want to use this inside an custom inspector, it is probably easier to work with SerializedProperty’s. Sinse they handle this automatically. Make sure you use the CanEditMultipleObjects attribute though.

You’ll have to make your custom editor support multi-object editing. Check the manual here.