Unity Fatal Error: dataOffset !=file.GetPosition()

I was importing a package from Unity store and got this error:

Fatal Error:
dataOffset !=file.GetPosition()

There are probably many reasons why this error can appear but the first thing you should do is check if there is insufficient space on your computer’s hard disk (the one where you keep your projects and also the one where you keep Unity – if they are not on the same disk). I got this error wile importing very large assets package from the Asset Store Window.

So, delete some files (that you do not need anymore) from hard drive and you should be fine.

If you need to to see what makes your disk full, you can use TreeSize Free tool.

 

 

Unity 2019 error: Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0 language specification

After upgrading Unity editor from 2017 to 2019 you might get some of these errors when you update your old project and hit play:

…/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs(1865,73): error CS1644: Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0 language specification

…/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_Private.cs(1916,130): error CS1644: Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0 language specification

there are other scripts that might give error: TMPro_UGUI_Private.cs, TMPro_Private.cs, TMP_Text.cs, TMP_MaterialManager.cs,… lots of them.

The solution is simple:

Go to : Edit -> Project Settings -> Player -> Other Settings -> Configuration

and change Scripting Runtime Version to .NET 4.x Equivalent, click RESTART and all those errors should disappear.

Scripting Runtime Version

Unity3D – MissingReferenceException: The object of type __ has been destroyed but you are still trying to access it

If you get this error:

"MissingReferenceException: The object of type __ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object."

then the first thing you should do is to check if you have (additional) inspector window locked. Simply unlock it (you can see the small lock in top right corner of inspector window) and this error should go away.

unity3d inspector lock
I have no idea what is causing it (I am just starting out with Unity) but this solved it. Luckily I found the answer quite fast and did not need to debug and waste a lot of time checking the code when the code was completely fine.