Prefab error message could do with more info

I just got an error message:

The problem is, I got it when running this:

AssetDatabase.ForceReserializeAssets(all_assets_in_the_project);

I could grep for the string ‘Financial District’ in all of the prefabs in the project, but in general it’d be nice if the “This is not allowed” error message didn’t only mention the instance, but also the prefab or scene the instance is contained in, since it can be a side-effect of running scripts over large amounts of assets.

When I click the error message, my project’s prefab folder is pinged in the hierarchy, which makes it seem like that folder is passed as the context argument to the LogError. It’d also be nice if the containing prefab or scene was passed instead.

Hmm, yeah, this message makes little sense when using ForceReserialize.
When creating a prefab from an instance in the scene or trying to save a prefab in prefab mode, it will actually ping the object in the hierarchy.

But reserialization of prefabs works by using LoadPrefabContents and then simply save it again. Which means the prefab is loaded into a temporary scene and unloaded again.

So by the time you see the message in the console there is no object to ping as the instance in the temporary scene has been destroyed. Unfortunately the pinging then behaves a little strange but you can really blame it for that.

I am not sure how we can fix this.

I’ll make sure we create a bug report for this, but I can’t guarantee we can fix it.

I made a bug report in case that helps; Case 1262196.