unity crashes after git reset with no hint on what is going on

394 Views Asked by At

I am developing a game in unity for 4 months now. today I reset my local repo to a state from a few days ago. since then, unity claims there would be "compilation errors" and offers me to open the project in "safe mode" or ignore the errors and continue to load the project. whatever I choose, unity crashes.

What I tried:

  1. Open the project by clicking "ignore" in the unity dialog. Unity suddenly starts modifying the using statements in my C# files. I have no clue as to why that is. Rider starts complaining about issues.
  2. Reset git to the current state again. Rider says everything is fine.
  3. Copy the whole folder to be able to do multiple repair attempts.
  4. Download the current state from Azure DevOps, overwrite everything in the project. Unity is now able to open the project in safe mode and starts complaining about missing files in the library and library / bee folder. I found the missing files in other projects and 1 on a random git repo online that seems to mirror official sources and keeps older version. While working through that I noticed unity started to complain about missing C# scripts. The scripts were there, but it was searching in an old location of the scripts. So I think something got reset to the old state and is stuck there :S I moved the files including the meta files to the old location and restarted unity. Now it complained about components in library and library / bee again, so I copied the files there and unity started crashing again.
  5. create a new project, copy my files and the asset files in there. unity crashes

Unity crash:

Obtained 10 stack frames
0x00007ff700d33866 (Unity) AssetImportManager::Import
0x00007ff700d37b94 (Unity) ImportOutOfDateAssets
0x00007ff700d42f79 (Unity) RefreshInternalV2
0x00007ff700d4ab7f (Unity) StopAssetImportingV2Internal
0x00007ff700d384bd (Unity) InitialRefreshV2
0x00007ff70053d566 (Unity) Application::InitializeProject
0x00007ff7009d5495 (Unity) WinMain
0x00007ff701d9c9ae (Unity) __scrt_common_main_seh
0x00007ffbe0a326bd (KERNEL32) BaseThreadInitThunk
0x00007ffbe0cadfb8 (ntdll) RtlUserThreadStart

CrashLog: https://pastebin.com/SurWU6QT

The crash log states: Symbol file LoadedFromMemory doesn't match image F:\prog\Unity\myProject\Library\PackageCache\[email protected]\Editor\VisualScripting.Core\Dependencies\YamlDotNet\Unity.VisualScripting.YamlDotNet.dll Symbol file LoadedFromMemory doesn't match image F:\prog\Unity\myProject\Library\PackageCache\[email protected]\Editor\VisualScripting.Core\Dependencies\DotNetZip\Unity.VisualScripting.IonicZip.dll

I excluded the package cache from my git repo as I thought it's just a cache that can be rebuilt.. copying the files back seems to be an issue. As soon as I remove the folder Library\PackageCache\[email protected] I can open the project in safe mode, but get these errors: error CS0234: The type or namespace name 'VisualScripting' does not exist in the namespace 'Unity' (are you missing an assembly reference?) Package manager things it's installed, but uninstalling and reinstalling the package causes unity to crash with exactly the same error as stated in the crash logs above :/

After uninstalling visual scripting and removing all (unused) references to it in my code, unity crashes on start. I have the feeling that as soon as there are no errors, it crashes. In the crash logs, it still shows the native crash and Got a UNKNOWN while executing native code. together with the Managed Stacktrace: stuff.

I'm not a professional (game) developer and completely lost here, fearing for the loss of the unity project.

can somebody please help me figure out what is going on here? I've been battling this for hours without any progess. Is unity stuck in the old state that I initially tried to restore? I assume a big part of the issue is that in the meantime, I upgraded unity from 2022.1.f1 to the current version 2022.2.f1. Is unity confused because of the upgrade? how do I restore a working version?

Thank you so much!!

1

There are 1 best solutions below

0
On

As mentioned by @RetiredNinja and @PSGuy, the solution is to:

  • git clean -fdx with Unity closed
  • Doing restore tests with another local repo regularly

Also, I updated my .gitignore with the content from https://github.com/github/gitignore/blob/main/Unity.gitignore