这是我的代码,
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();
}
这是我在编辑器窗口中的代码,onGUI 函数。
我正在尝试为代码创建撤消。我不确定如何撤消 Toogle 值。
Undo.RecordObject(OBJECT, STRING);
有什么方法可以将 bool 更改为 Object 以便撤消它?如果有人能让我开始只是为了布尔,我可以做剩下的。