Force Text Serialization crashes Unity

When I change the Editor option to serialize assets using text, Unity crashes.

Can anyone recommend a workaround or point me to a log that shows which asset blew the fuse? The crash dialog nicely points to Texture2D.cpp but doesn’t tell me which texture asset was the cause.

This may be a Unity problem: with my scene open Unity takes up 900 MB of RAM. Upon forcing text asset serialization, Unity grinds up to 3.5 GB and then crashes. (System has 16)


In case anyone else comes across this, I thought I’d provide a little info. This isn’t a problem specific to any particular asset or project. This is a problem with Unity itself. When attempting to change to Force Text, Unity appears to re-serialize the entire project in memory at once. For large enough projects, this memory usage gets quite high. It appears to scale roughly with the number of assets you have. Unity <5.0 is a 32 bit application that is Large Address Aware. On 64 bit Windows, the application can use 3 GB of memory before it will fail to allocate more. Unity, being awesome, crashes when this happens.

So far, the only way I know around this is to have a smaller project. I’m currently in the process of trying to convert a 30 GB project from Mixed to Force Text for our switch from the Asset Server to SVN (what a nightmare the Asset Server has been for this large of a project) and it’s a shitshow. My current idea is to copy out half of the assets, switch to Forced Text, then copy the moved assets back in. Who knows if it’ll work…

EDIT: That ended up working. I turned on visible meta files so GUID references wouldn’t get broken. Then I moved assets out of the project folder until Unity stopped crashing when changing serialization to “Force Text”. Then a I copied a few items at a time back into the project and let Unity import them. This is tantamount to a full reimport of all assets, so obviously it took a while. The only thing that broke in the project was string fields serialized in NGUI objects. I wrote a fast script to repair all those. Overall, it ended up taking just over 2 days to go from Mixed to Force Text. What a pain. Interestingly, changing to mixed or binary serialization doesn’t seem to have the same memory problem. Note to self: never use the Unity Asset Server for version control and always start out with Force Text.