How to fix lost references?


I had a weird thing happening to my project. I imported the OneSignal lib, then moved it to the plugins folder, because it couldn’t be referenced by a plugin and now I have lost in a project over +1000 references. Is there any way to bring the referencing back? It will be impossible or either very time to consume to go through all referencing again.

I’m not sure what the references you are talking about are. An imported lib only has a few references and they are to the projects inside a solution. As far as i’ve seen, Unity generaly creates 2 types of projects. One for runtime scripts, one for Editor scripts. All scripts referencing the library use Namespaces and class names. If your projects references the library, your scripts should be able to find the library.

The first thing to do is check in your project if it references the library. Check also that the library path is the same as the new one. If not, that is your problem. If you still have reference errors, i suggest you reboot your Editors (both Unity and the IDE you use for script editing). Unity is supposed to automatically add the references to managed libraries it finds inside the asset folders, so i think there might be a cache problem.

@kaplica, it’s insane. I’ve just had the same issue in 2019.3.14. I have build a project in VS2019. Then Unity Editor was reporting some incorrect assemblies pointing to non-existent code that was commented out. I’ve exited Unity, started again… No compiler errors but ALL references to scripts, fonts, sprites etc are gone. I tried to diff the difference but it’s a massive scene so I can’t quite make sense of the change.
It scares me a lot.