|
I have a GameObject whose gizmo is drawn differently depending on certain properties of the GameObject which are modified through a custom editor I've created for it. As it is now, if I modify one of the properties, the gizmo isn't redrawn until I click in the scene view. Is there any way to manually update the either the scene view or just the gizmo when one of the properties is modified?
(comments are locked)
|
|
I believe HandleUtility.Repaint does what you want. This only works in the editor. You can not build the project with this code in it. Any other ideas?
Oct 20 '10 at 05:16 PM
ClandestineMan
Should be in Editor folder of your scripts as it is editor functionality, you don't have a scene view in final build, so what use would it be to have it compiled in project.
Nov 10 '10 at 03:49 AM
Jaap Kreijkamp
It sounds like it should do what the OP wants, but it doesn't seem to work. I have the same issue. HandleUtility.Repaint doesn't refresh my scene view (I'm on Unity 3.3 on a Windows PC).
Sep 07 '11 at 11:19 PM
yoyo
(comments are locked)
|
|
You should use this code:
For more details see the documentation "LookAtPointEditor.js" This works although it marks the scene as unsaved. In my case I need to redraw the scene when the user changes the current tool in the inspector, which obviously doesn't make any change to the component itself. But the scene must be redrawn to display a different set of handles. But I guess I can live with it :)
May 05 '11 at 07:51 PM
hardwire
+1, this worked for me. Agreed on not liking the dirtying of the scene, but I can also live with it. Has anyone filed a bug report about HandleUtility.Repaint not doing what it seems like it ought to?
Sep 07 '11 at 11:19 PM
yoyo
(comments are locked)
|
|
I just ran into this same question today myself. To further clarify the situation: I have a series of checkboxes in my inspector that set static variable values to determine which handles to display. My OnSceneGUI() function tests the values of these variables to determine whether it should draw each handle. Though I could confirm these values would update in my OnInspectorGUI() function, I could not confirm they were updating in OnSceneGUI(). In order to make the scene view redraw, I put a call to HandleUtility.Repaint() first thing in my OnSceneGUI() function. I don't know if this is correct or ideal, but it works. I'd be interested to know if there is another way we are supposed to be doing this so I don't force repaint at all times if it is not needed.
(comments are locked)
|
