Hi!,
After reading some answers about forcing repainting in a unity3d editor and realizing they do not work for me I have written a little example:
[CustomEditor(typeof(LocalizationData))]
class LocalizationDataEditor : Editor
{
LocalizationData data = null;
void Awake()
{
data = target as LocalizationData;
}
public override void OnInspectorGUI ()
{
if (Event.current.type == EventType.Repaint)
Debug.Log("Repaint.....");
if (GUILayout.Button("-", new GUILayoutOption[] { GUILayout.Width(30) }))
{
//GUI.changed = true;
//EditorUtility.SetDirty(target);
Repaint();
}
}
}
This should be firing a repaint event everytime I press the button but it is not firing. If I click out of the editor and then move mose over the editor I see how it is firing, so, I suppose the code should work.
I have spent part of the day trying to figure out why this is happening without any success. If anyone could help here I would really apreciate it.
Thanks in advance.
Is 'collapse' active in your console? The Button probably already sends a repaint request both when it releases and when it is pressed; the Button's request and your request may be merged into a single repaint request (but I'm not sure how it all works under the hood). Can't be much more help than that; I've used Repaint myself in MouseDown and MouseDrag events and haven't had any issue with it not triggering. :(
– LoiusExcuse for the dumb question, but what you mean by "is collapse active in your console?". On the other hand I have been logging all events arriving to the OnInspectorGUI and when a click on the button is performed it won't do an authomatic repaint either :/. Thanks in advance.
– hexdumpHi everyone, I'm bumping this issue up, I'm encountering the same issue : I have a custom inspector on a Scriptable Object, and calling either SetDirty / Repaint doesn't update my inspector. Anyone has a clue ?
– RAPDel