However, you might be unlucky that the deleted script used to reside on hundreds of GameObjects! That’s a lot of tedious clicking to be done, and it sure does tingle my editor scripting senses.

Editor Scripting to the Rescue!

Whenever I come across a task that bores me even before I start it, it’s a good sign that it’s because it needs automation! Automating boring and time consuming tasks is definitely something that tickles my fancy – not only because it is fun to kill off tedious, monotonous tasks for good, but also because it makes for a much better workflow in the long run!

Anyway, to get back on track, let’s assume that the script that is now missing was previously residing on a thousand different GameObjects (exaggeration get’s the point across – I hope you will never end in this scenario). In order to remove the missing script from one GameObject, we need to do the following actions:

Click on the warning thrown in in the console. Notice what object is pinged in the hierarchy, then click on it. Right click the missing script (or click the little cog icon in the top right corner). Click ‘Remove Component’.

In the nightmarish scenario where the script was on a thousand different GameObjects, that amounts to a staggering four thousand clicks to remove the annoying warnings (assuming you are not absolutely savage and just ignore them by filtering them out in the console). Wow.

Now you’re just making me angry. show me the money!

Okay, enough chatting about. Today I was in this very scenario (although less extreme), so I deviced a simple editor utility script to automatically select all GameObjects in the scene with a missing script, all by the click of a button!

This way, we can simply skip straight ahead to step 3. of the previous list, and this time, we won’t have to repeat the process! So let’s get our hands dirty. We’ll start by creating a new C# class to handle the functionality. I called mine ‘SelectGameObjectsWithMissingScripts’. “Short” and concise.