- Home /
Calling RegisterCreatedObjectUndo on an Asset is buggy
I am attempting to enable "undoing" the creation of a new custom .asset file. I have done the following:
MyScriptable obj = ScriptableObject.CreateInstance<MyScriptable>();
// <--- Initialization code here --->
Undo.RegisterCreatedObjectUndo(obj, "New Custom Asset");
When I attempt to undo the registered action, the asset's icon in the Project view goes away but the name remains. Further, in checking the finder, both the .asset file and .meta file are visible. Is it actually possible to "uncreate" an asset as one would expect?
I am running Unity 4.3.4.
I don't believe that it is possible to undo changes that effect the file system with new objects - it works for scene objects of course.
That would make sense. $$anonymous$$ind of wish that type of restriction were properly outlined in the documentation for the function...
Your answer
Follow this Question
Related Questions
Can you use a more performant undo function than RegisterSceneUndo with DestroyImmediate? 2 Answers
EventType.ValidateCommand includes Undo? 0 Answers
Undo in Editor only executed when I switch focus to Hierarchy 0 Answers
How to use the Undo class to record editor script property changes? 2 Answers
Undo Doesn't work in Unity 3.4? 6 Answers