Getting properties on 'missing' things in Editor Scripts?

Often when I move assets (even as Packages) between computers, I have missing scripts, missing materials, missing textures. In the case of scripts, it says 'missing mono script' BUT it lists public variables that those scripts had before it went missing.

I'd like to write an Editor script that will a) find missing components like that, and b) try to match them up with the asset (say, script by comparing public variables), and c) re-attach the assets.

Is any of that possible? I found a script that will detect missing scripts, but how would I get those public variables that it seems to remember?

Is there any way to 'patch up' 'missing' assets?

For example, Prefabs seem to get detached. There is no way to reattach them (that I know of), except to re-add the Prefab, fix it's name if needed, and reset transform etc. as needed. I want to script that.

Help please!

Find Missing Script

After much searching, coding, and frustration, I've concluded that it is not possible. The best course of action is to use Reflection to save off important settings to a file, then import that file to recreate the objects as needed. Not easy.

I want to try and solve the same problem. Did anyone ever find a way to do this? We often move scripts from being a loose .cs file into a pre-built assembly, or from one pre-built assembly to another. This always breaks the script linkages everywhere and takes a lot of time to manually fix everything. The “Find Missing Scripts” technique helps a bit, but it would be very easy to automatically fix all the scripts, if only there was a way to set the script that the component points to. Currently, the Editor API only provides a way to add new components. I cannot find any way to modify the script that an existing component points to. I know it’s possible since the Editor itself allows you to change the script that a component points to, so maybe this is something easy to support in a future version of Unity?

I’ve posted a utility in the Asset Store which has an Editor script that can fix broken / missing prefabs.