So my game works in editor but when i build it say one of my levels is corrupted? I’m not sure how to fix this. please help all help is appreciated
this is what i get in the development log:
The file ‘/Users/joshua/Documents/Fps/Test_01.app/Contents/Data/level0’ is corrupted! remove it and launch unity again! [position out of bounds! 16068 > 16064]
The file ‘/Users/joshua/Documents/Fps/Test_01.app/Contents/Data/level0’ is corrupted! remove it and launch unity again! [position out of bounds! 16068 > 16064]
The file ‘/Users/joshua/Documents/Fps/Test_01.app/Contents/Data/level0’ is corrupted! remove it and launch unity again! [position out of bounds! 16068 > 16064]
In my case, the build would work if I started a new blank scene. So I copied the contents of my scene that was leading to the corrupted level0 error, and pasted them into my new blank scene. It worked fine after that.
That usually means that the level data was built using a different version of Unity to the run time. Maybe create a totally new build and see if that has the same problem.
This bug might be related. It exists in the latest version (today 4.5.1f3) and for what I could tell it exists in previous versions as well.
This is a repro case:
A generic class with a generic array
using UnityEngine;
public class GenericBaseClass<T> : MonoBehaviour {
[SerializeField]
private T[] objects;
}
A derived empty class (might not even be necessary)
public class DerivedClass : GenericBaseClass<DerivedClass> {}
Now create any object and attach the DerivedClass component to it. Compile your build with debug enabled and run it and the error will show.
The current temporary fix I found was to use a Object[] or GameObject[] instead of T[] (losing type safety) and use GetComponent() (and casting to T) to retrieve the T (losing some performance).
This issue does not seem to affect the webplayer (at least my repro case doesn’t affect the webplayer, but I didn’t run extensive tests).