4.5 Builds not working - resources.assets' is corrupted!

***Update – This looks to have been an issues with how unity was handling generics ****

At least that was our issues

Only during builds in 4.5 do I get these errors…?
Any Fix to them? Or is this a bug?
Builds worked just fine in 4.3.4

The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/sharedassets2.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 142139508 > 142139504]

(Filename: Line: 273)

The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/sharedassets2.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 142139464 > 142139460]

(Filename: Line: 273)

The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/sharedassets2.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 142139420 > 142139416]

(Filename: Line: 273)

The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/sharedassets2.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 142139380 > 142139376]

(Filename: Line: 273)

UnloadTime: 0.506547 ms
The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/resources.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 487487628 > 487487624]

(Filename: Line: 273)

The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/resources.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 487487108 > 487487104]

(Filename: Line: 273)

The file ‘C:/Users/Mark/Documents/Vergeous/Novus/ffff_Data/resources.assets’ is corrupted! Remove it and launch unity again!
[Position out of bounds! 487488188 > 487488184]

(Filename: Line: 273)

Any Ideas anyone?

Are all those files created by 4.5? Occasionally these errors appear if a 4.5 runtime is trying to load data files that were created in an older version. You can see which version these files were created in my looking at them in a text editor. Although they are most certainly binary, there is a 7-character representation of the version number near the start of the file.

If you have data files created by the 4.5 version of Unity, then these errors are possibly related to serialisation. (But I’d assume the first given that these errors report a 4-byte difference.)

I thought too at first, but then I changed the name of the build and the same issue occured

For what it’s worth, we used to have this problem last summer, fixed with an asset tidyup and reimport. I never found what the actual cause was and so was unable to report a bug for it, couldn’t really submit many gigs of our IP.

Found out the problem: Looks like unity 4.5 didn’t like my multi-Inherited nested generics. Long story short, I went with a Simpler solution and its working fine now.

I’m having the same problem. Checked asset version and it’s 4.5.1f3 (correct). I don’t see where the problem can come from. @Graham-Dunnett any hints on what can cause this?

It reports position out of bounds, and the difference reported it seems to be always 32.

More details… I found the exact class that gives me trouble, and it seems to be my BindList class.

My MonoBehaviour has a reference to BindList (no defined fields). BindList inherits from CustomList. CustomList layout is (Bind[ ], int, int). Bind layout is (string, Component, string, bool, bool). All those are classes, marked with Serializable.

Everything works fine in editor, I think I’m managing serialized classes and fields properly, and cannot find why the resources bundle isn’t generated properly.

Hm, have you checked if any of your properties may not be making it into the build somehow? It’s a long shot, as it normally causes a secondary warning at runtime, but it does cause this sort of corruption, by screwing up the serialization stream length.

I’ve checked, but I don’t see how they could be affected. No clue.

CustomList:

public T[ ] buffer;
internal int size = 0;
int initialSize;

Bind:

[SerializeField]
internal string id;
[SerializeField]
internal Component component;
[SerializeField]
internal string fieldName;

public bool state1;
public bool state2;

[NonSerialized]
internal FieldInfo field;

Note that Bind implements ISerializationCallbackReceiver, which basically fills the FieldInfo after deserialization

Seems to be related with

  • (612215) Scripting: Fixed support for serializing array of generic types

I’ve updated to 4.5.1p4 and it seems to work. Thanks guys!

Nice catch, ill put your findings into the top post

How to solve this serialisation issue???

I am still getting this error. Currently i’m using 4.5.2. I tried patch 1 & UNITY 4.5 but, no use.
Any Ideas anyone?

Are you using multi generic, generics?
I had classes inhareted from generics that were defening generics within them selves that were passing generics from the inhartiting cladd