|
Hi unity boffins, I have an editor script that provides both a OnInspectorGUI and OnSceneGUI function that are both trying to support undo via Undo.SetSnapshotTarget. I my case the OnSceneGUI provides Handles.PositionHandle to edit spline control points, while the OnInspectorGUI provides int, float and Vector3 fields to edit various parameters. My problem is I get a constant error message (as per title) every time I edit one of the PositionHandle gizmos? It doesn't seem to cause any issues (undo works fine) except cluttering my log console. If I double click on the error in the log it takes me to the: Vector3 newCp = Handles.PositionHandle( cp, handleRotation ); line of my editor script. The functions that the error refers (SaveSnapshot and MakeSnapshot) are emanating from Handles.PositionHandle but these seem to be deprecated? or at least they are now internal API and not part of the public API documentation. Because I have a lot of interdependent code I've quickly made a small example of how I call the undo related functions (this should produce the error). Excuse the code compactness. There are some questions in the comments of the code too. Thanks file: ExampleSpline.cs
file: Editor/ExampleSplineEditor.cs
(comments are locked)
|
|
The issue ended up being I needed to make sure all Undo.SetSnapshotTarget came after Handles.PositionHandle calls. i.e: Thank you! I was having the same error, but this seems to have fixed it without impacting the ability to undo. Though I still don't understand how it works when SetSnapshotTarget() is called after the handle has (presumably) started editing the object.
Jan 20 at 01:42 AM
adurdin
Thanks man for clearing this out for me! Seems like unity could use a proper Undo tutorial in order to get all calls at the right time.
Feb 22 at 02:40 PM
.sanders
(comments are locked)
|
