In our skeleton animation for one character, we have a json file with size 190KB. When the whole skeleton animation object is being loaded from asset bundle for the first time, our game pauses for 1 seconds, and there is 4MB memory allocations...It considered slow and too much memory consumption. Is this normal? Or are missing any steps when build the animation files into a bundle?
[Unity] Parsing json file causes 1s with 4MB allocations
- 수정됨
I've never had a pause of 1 second because of json parsing.
Haven't seen how much deserializing normally allocates though.
In general, it's probably good to load all your needed jsons with a preloading screen by calling the skeletonDataAssets .GetSkeletonData() there, so you don't get weird pauses in the middle of actual gameplay.
Guh we really need to get binary into the Unity runtimes >.>
Maybe I do that soon.
Hope we can get binary into Unity soon!!
The current json parser is making a lot of recursive invocations and allocating a lot of collection objects (thousands of dictionaries), in my personal opinion there is a chance to optimize it.
Yea i've avoided dealing with the JSON parser because its like...if the goal is to get performance...and there is already a binary format.... why bother?
Agreed. JSON is not the format to use if performance is important. Soon, I promise!
That's cool guys! Looking forward to the binary support :-)
Binary support for C# is in Git now!
Nate wroteBinary support for C# is in Git now!
Nice. Too bad its benchmarking slower than the JSON importer
How are you benchmarking? I updated spine-unity so a binary file (the file must have ".skel" in the name) can be specified instead of a JSON file. Binary takes 0.011 and JSON takes 0.049. I left the benchmark code commented out in SkeletonDataAsset.
There's one issue where SpineEditorUtilities GetRequiredAtlasRegions
doesn't work for binary files.
Nate is the equivalent Greek Adonis god of coding. My bad.
im trying to load my binary file into unity but it doesn't work. Its called skeleton.skel and when I put it into the Spine SkeletonData the animation doesn't show up. It works with json tough.
Can somebody help out?
Unity doesn't recognize arbitrary extensions. It's stupid.
For text assets, you need to save it as .txt
, which is why the atlas files are .atlas.txt
.json
"support" was a recent addition.
But for binary files, they need to be .bytes
files.
So the recommended file extension is .skel.bytes
.