Unity3d Undo is EditorWindow [for bools and strings]
Here is my code,
CoreGlobal.OnMobile = EditorGUILayout.Toggle("Mobile Build", CoreGlobal.OnMobile);
if (Selection.activeGameObject && Selection.activeGameObject.tag == "CBC")
{
selectedTransform = Selection.activeGameObject.transform;
fold = EditorGUILayout.InspectorTitlebar(fold, selectedTransform);
if (fold)
{
selectedTransform.position =
EditorGUILayout.Vector3Field("Position", selectedTransform.position);
EditorGUILayout.Space();
rotationComponents =
EditorGUILayout.Vector4Field("Detailed Rotation", QuaternionToVector4(selectedTransform.localRotation));
EditorGUILayout.Space();
selectedTransform.localScale =
EditorGUILayout.Vector3Field("Scale", selectedTransform.localScale);
}
selectedTransform.localRotation = ConvertToQuaternion(rotationComponents);
EditorGUILayout.Space();
}
this is the code I have in my editor window, the onGUI function.
I am trying to create a cancellation for code. I'm not sure how to reverse the google value.
Undo.RecordObject(OBJECT, STRING);
In what ways can I change the bool to Object so that I can reverse it? if anyone could get me to start just for bool I could do the rest.
+3
source to share
1 answer
I don't think this is a great answer, but you can do something with this callback. It's not a perfect solution, but it should be a start.
http://docs.unity3d.com/ScriptReference/Undo-undoRedoPerformed.html
And then you could register the cancellation with a mock object and then somehow figure out how to determine what cancellations were made?
0
source to share