I have a question regarding “Asset Serialization Mode”.
How can I convert the serialization mode of some assets?
“Asset Serialization Mode” is set to “Force Text” in our current project but I would like to convert some assets to binary format to reduce the file size and increase loading speed.
I figured out that I can mix Text format and Binary format by selecting "Mixed” from [Edit]->[PROject Settigns]->[Editor].
I couldn’t find how to make certain assets Binary format (or Text format).
I want to keep some assets like Prefab to text format so that changes are noticeable and convert resource assets such as FBX to Binary format to reduce file size.
I looked up community sites and UnityDocumentation, but I couldn’t find a solution.
If you have any information, please share.
Thank you for your reply.
What I wanted to change to “Force Binary” was “Animation Clip”.
(I gave FBX as an example by mistake.)
Since “Animation Clip” is created inside Unity, Asset serialization will affect it.
>Have you profiled your loading time with “Force binary” mode to confirm that is causing your problem?
In fact, I would like to know how to convert assets in Text format to Binary format for this.
I changed “Force Text” mode to “Mixed” mode but .anim file contents remained in Text format.
I could use “Force Binary” mode for verification but it takes so much time so I would like to convert only certain files to Binary format.
Is there a way to control from script for example import settings?
I have a similar question; Basically, I want to change serialization for a given set of assets only.
The problem is, if I change serialization mode in the settings, it seems that ALL relevant assets are re-serialized, which is not want I need. Is there any way to set the mode only for a specific set of assets? If not, I think this option should be added.
When I use Asset Serialization Mode in Unity it converts all assets. BUT I need to control this process and choose assets that i need. Is there any API to invoke resealize to particular Asset Serialization Mode for particular assets?
I would even settle for being able to change the setting per asset type. We need to serialize all animations as binary, but the scenes are fine as text.
Can we set some files as text now in Asset serialization “mixed” or “force binary” mode?
I have a lot of animation files and some xml files. I need keep xml files as text mode.
I have a large scene in unity that even when “force text” is set will only save as binary. Smaller scenes in the same project save as text. Very strange.
bump since per-asset serialization type override can be REALLY useful:
we want our scenes/big prefabs to be serialized as binary files to save size/saveload time.
But for project setting file, text serialization is WAY better since changes applied under different build configs can be easily merged by any text merger
I also wish we had this feature. For example, we have large scenes (200+ Mb) that we don’t want to be text assets, but also have a lot of other assets that would be great to have in text mode.
So, custom serialization format for each file would be really helpful.
I did find a workaround some might find helpful. You can create an empty container ScriptableObject class with the PreferBinarySerialization attribute, like this -
[PreferBinarySerialization]
public class BinaryAssetContainer : ScriptableObject { }
And then package the assets you want into a BinaryAssetContainer asset. Not the prettiest solution but if you need to save the file space (eg. get under Github 100 MB per file limit) it works!
Yes , thanks for the tag. Unfortunately, [PreferBinarySerialization] isn’t working for me, because I generate an UnityEngine.Mesh rather than a custom asset where I would have the opportunity to add the attribute.
Maybe I understood this incorrectly but, wouldn’t saving the mesh inside this “BinaryAssetContainer” (via AssetDatabase.AddObjectToAsset) save the whole thing as binary? Maybe