- Home /
Refreshing custom Inspector window while playing
Hello,
I need to have an Inspector window constantly refreshed while the Editor is playing (to show some data). How can this be achieved?
I used to rely on calling Repaint within OnSceneGUI, but that works only if the Scene window is visible.
Thanks
See my answer to http://answers.unity3d.com/questions/333181/how-do-you-force-a-custom-inspector-to-redraw.html for another alternative.
Thanks for that. Now I wonder why I didn't think about it before :B
That's odd, I just noticed your name shows up one way in the "signature" for questions and answers, but differently for comments. Looks like a bug.
Yup, I usually point that but this time I forgot, and it seems it happens to other people too. Quite a big bug for a community like this.
Easy "fix" -- edit your profile and make real name and screen name both the same :-p
Answer by Demigiant · Oct 10, 2012 at 06:20 PM
SOLVED. A custom Inspector window will automatically refresh if one of its target's serialized properties change.
When playing, you can set a coroutine to change a property continuously with the desired interval, thus automatically refreshing the Inspector (you'll want to check Application.isEditor first, to avoid starting a useless coroutine while not in the Unity Editor).
There's a subtlety to this: If a serialized property is not naturally "inspectable" (eg: it is using custom accessors), then updating this property will not cause the inspector to refresh.
I am in a situation where all the relevant property use accessors; despite them being shown through custom inspectors, the still inspector will not automatically refresh.
Your answer
Follow this Question
Related Questions
Make a custom inspector that shows a group of variables in form of list 2 Answers
Custom Inspector "Multi-object editing not supported" 4 Answers
How to Hide/Show List or Array in the inspector based on a variable? 0 Answers
Should I use Inspector or custom editor window? 1 Answer
Show texture (image box) in inspector with custom editor [C#]? 3 Answers