I opened my unity project today and all of my public variable references are gone now (strings, gameobjects). Is there anything I can do? I don’t have these saved anywhere else and I really need them
I haven’t done any version changes or touched the unity project files so idk why this would’ve happened
100% all of your references are gone?
Does your version control show when the data was changed?
First up, you should (have) ask(d) in Editor and General Support. This isn’t a support section.
Next, what exactly did happen to the project folder? Was it copy / pasted, was it moved? Also, where is it stored? Project folders used from places such as DropBox or OneDrive commonly have issues.
They have GENERAL issues as they do not do proper versioning of files, just overwriting the latest changes. Unity projects in synched folders are not supported and are prone to break.
My project folder is stored on my desktop folder, and I’m 100% sure I’ve turned off onedrive sync in the past. I did copy and paste the project folder but it was months ago so I don’t think that would be the problem
I went thru most of the gameobjects and its only about half of them thankfully, and I haven’t used version control for my project
Has it worked since you did that?
Do you run any ‚security‘ software (antivirus) or ‚cleaner‘ tools besides Windows‘ builtin features?
There is also enough free disk space? Since the project is most likely on the Windows install drive, at least 20GB or more than twice the installed memory size should remain unused due to the dynamic nature of the swap file, and system operations like update downloads and installation.
Aside from technical issues, it is concerning when a project loses some of its serialized data (field references) without breaking entirely. It is easy to lose an Object subclass reference when the associated asset .meta file is tampered with or deleted (the GUID changes). Or by assigning references in code where the reference is to a scene object but it is applied to a prefab (prefabs cannot reference scene objects).
But this cannot explain why a ‚public string field;‘ would lose its value because that string is serialized into the prefab or scene asset itself. Unless you did not mean the ‚string‘ type but some other reference that only seems to be a string in the Inspector (and isn‘t an enum).
Actually…
… tell us more. When you say they’re “gone”, what exactly does that look like? Do they show as “None” or do they show as “Missing” or something else?
Which half? Is it half of the references on all GameObjects, or is it half of the GameObjects have all references missing?
What are the missing references to - scripts of your own, or built-in types?
Also, are there any errors in your “Console” tab. In particular, does your project compile successfully?
Also also, have you installed a different version of Unity since you last worked on this project?
Also also also et al … have you tried deleting the Library? (with the project closed of course)