3
這裏是我的代碼,Unity3d撤銷是EditorWindow [爲布爾變量和字符串]
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的方式,以便我可以將其撤消?如果任何人都可以讓我開始只爲布爾,我可以做剩下的事情。
'Undo.RecordObject(Selection.activeTransform,「設置欄」);'在更改自定義編輯器中的轉換時有效。但除此之外:/ – kks21199