Page 1 of 1

Can't delete state with a missing StateBehavior

Posted: 2017/07/08 21:30
by igor
Cannot remove "State" which contains a non-existent script.
The script was removed, but the "state" remains.


Screenshot:
https://gyazo.com/e8e03eea119e52bf5b8323b0dcf2078f

Delete does nothing (doesn't work).

Re: Can't delete state with a missing StateBehavior

Posted: 2017/07/08 22:37
by caitsithware
It is the Unity specification that the Missing object can't be deleted from the editor extension.
How do I Remove null components ( i.e. "Missing(Mono Script)" ) via editor script?

If the Missing object can't be deleted due to the Unity specification, Arbor also makes it impossible to delete it.
(In the content of Answers, fundamental solution seems impossible, so it is impossible to delete it as a provisional countermeasure.)

If you want to delete the script, take a backup in advance and be sure to check that the script is not in use.

Re: Can't delete state with a missing StateBehavior

Posted: 2017/07/09 00:18
by IgorAherne
maybe UnityEditorInternal.ComponentUtility can do it?

Re: Can't delete state with a missing StateBehavior

Posted: 2017/07/09 00:36
by IgorAherne
Also what about locating most suitable (temporary) script similar to this: http://daikonforge.com/forums/resources ... scripts.3/

And then removing the new "temporary" script?

Re: Can't delete state with a missing StateBehavior

Posted: 2018/02/28 20:31
by caitsithware
Internally in Unity, it seems possible to create Editor for Missing display even in Missing script.
(This is why the Inspector can display the Editor for Missing automatically)

However, using the Editor.CreateEditor method will return null and new SerializedObject and MonoScript.FromMonoBehaviour will throw an exception.
Also, when trying to get the class name with GetType(), it was UnityEngine.Object.

In this way, no information about the script can be obtained at all, so it is difficult to deal with anything so far.