Game crashes in editor when script assets are refreshed

I don’t know if this is a bug with Unity or just something that I am doing wrong, but I would love to isolate this issue and fix it - because right now, I can’t recompile scripts while my game is running.

Whenever any script asset in my project is refreshed, be that by me making a change to a script and Unity recompiling it or just by me enabling or disabling deep profiling, dozens of component linkages in my scripts are instantly broken - crashing my game.

It seems that all linkages that break are references to script components in other objects - such as “var vehicle : Vehicle;”.

Is this expected behavior, or is there some way I can work around this?

Thanks,

-Aubrey

To restore the links, you have to hunt down all the objects with FindObjectOfType and reassign them.

So this is expected behavior then?

Relinking everything manually is totally impractical for me - I have lots of things that are coming unlinked.

Couldn’t Unity relink the vars automatically, since it knows that it is unlinking them?