How do I find gameobjects or assets that have no name?

That is, I need to find an asset gameobject (likely an imported mesh) that has a missing script error, but the gameobject in question has a name that is an empty string.

Specifically this is the warning:
The referenced script on this Behaviour (Game Object '') is missing!

There are currently five of these in my project and while I can easily fix the error if I can find the object, I don’t know how to find the object. Attempting to even recreate this Unity generates the warning that A GameObject name cannot be set to an empty string.

As a root prefab it is hidden from the asset list, but the file still exists. Doing this to a GameObject inside the a prefab via a text editor doesn’t generate a warning, but this child object isn’t listed in the project window anyway the way it would be for a 3D model file.

Probably best to write some editor code to do the heavy lifting here.

For assets you could use AssetDatabase.FindAssets to run through everything and ping all objects which have an empty name.

You can probably use this funky method to load all sub objects to see if any have an empty name as well: Unity - Scripting API: AssetDatabase.LoadAllAssetRepresentationsAtPath

For game objects, you could probably just run through everything in a scene and again, ping anything with an empty name. For prefabs, they will come up with FindAssets, and you may need to just run through all their child game objects/components as well.

Part of me remembers there being a specific method for finding missing behaviour scripts on game objects but I can’t find it…

Yeah, I figured that’s what I was going to have to do.