How to get an error/warning about missing scripts on gameObjects?

Is there any NORMAL (= without making other scripts) way to get an error or warning when you rename or delete a function in a script that is attached to a button On Click in the Unity Editor?
Currently unity keeps working like nothing happened, until I actually click the button.
We can’t be expected as devs to always keep in mind to go to 1000 buttons in the Editor and change their functions when we simply rename a function in code. Because of this I try to avoid like the plague using the Unity Editor do drag and drop things, I literally cannot trust it.

Hi @self_made,


I didnt used unity lately, but maybe you can make use of this.

You can make a check in the script which you use the items in. With the

if (YourGameObject.GetComponent<YourScript>()==null) Debug.Log("missing script.")

or if you want a warning

if (YourGameObject.GetComponent<YourScript>()==null) Debug.LogWarning("missing script.")

The ‘best’ way so far I’ve come across is:

Assert.IsNotNull(yourGameObjectOrWhatever);

This will essentially throw an error at compile time if you are in this scene with the gameObject that contains this code.

Please vote on this topic here, maybe someone at Unity will start to give a shoe about it…

https://feedback.unity3d.com/suggestions/required-field-attribute