Finding Hidden Unity Objects
Added 2019-05-31 16:19:23 +0000 UTCThis one's important enough I'm leaving it public, because folks may not realize this (and it can hose a build).
Unity has this nasty habit of leaving junk invisible objects in your scene. They get created mostly by asset store stuff you use, often as marker objects for in-editor stuff, and the objects they create are intended to never be saved with the scene. At all. Ever.
But Unity sometimes does anyways. Also, because they're literally invisible, you won't know when it happens. You'll just end up with scenes that, when you try to include them in a build, they cause mysterious errors. It'll run fine in editor for months, you'll hit a deadline, go to make a build, and poof, intractable unfixable bug.
But don't panic! There's a really easy solution: https://answers.unity.com/questions/613728/how-do-i-remove-a-game-object-that-is-not-visible.html
Right there, top post. Jamora's hidden object tools. Literally just copy-paste that into a script. Remember to put it in an Editor folder. Use those tools, sweep your invisible objects, and delete those bastards.
The other fun one is you can get orphaned game objects in your scene that have no scripts (because the scripts you had on them were deleted AND they were invisible in-editor objects), which makes a tool like this literally the only way of finding them. That's also how these hidden objects can break builds - they can get stuck in strange missing-script states you can't resolve because you can't see them and AAAAAAA.
So there, now you can fix that horrible edge case that Unity will cause with fair regularity! Have fun.
EDIT: Oh and the more common result of the invisible objects is they don't break anything, but they spam your console window with three thousand "object is missing script!" warnings. Except the object has no name you can search, so the warnings don't even have an object name, and no script you can search by (since it has no scripts at all), and just... yeah. Super annoying.