• Bugs
  • SkeletonRender.Awake takes several seconds to load a charact

  • تم التحرير
Related Discussions
...

We are having this issue with Unity 3d.

When character is set active, SkeletonRender.Awake() is auto-called by the skeleton component. This spikes the CPU 100% and takes 2.5-3 seconds per character to render. The app is frozen during this time.

We are not sure what the issue is here but it's killing our load times. I would like to get some help debugging this issue and maybe someone on the forum will understand what we are doing wrong or if this is a bug.

careychico wrote

We are having this issue with Unity 3d.

When character is set active, SkeletonRender.Awake() is auto-called by the skeleton component. This spikes the CPU 100% and takes 2.5-3 seconds per character to render. The app is frozen during this time.

We are not sure what the issue is here but it's killing our load times. I would like to get some help debugging this issue and maybe someone on the forum will understand what we are doing wrong or if this is a bug.

The first time GetSkeletonData is called on the SkeletonData asset, it has to parse the json file. How big is your json file?

  • تم التحرير

I suspect this isn't really an issue as much as it is something all games with significant assets have to deal with.
Admittedly, 2-3 seconds is kinda heavy for just one character. The size of the json file should be a good estimate of your complexity and how much data the runtime has to load. This is most likely a result of having a lot of animations with a lot of keys (if you could check, some of the keys might be unnecessary and you could remove them in Spine Editor to help solve the problem)

Just for info.
Spine automatically does lazy-loading the first time you use the a Skeleton so it's easy to prototype. If you have many or complicated stuff, it'll load slowly.
In an actual product, you should preload the skeletons by calling GetSkeletonData on the needed SkeletonData assets before or while you load your level or scene or something, so gameplay isn't disrupted.

Its also worth noting that Spine does actually have a Binary format export that could load orders of magnitude faster when implemented in the Unity runtime.

5 أيام لاحقا

Thanks for all the feedback. I will have my engineer review.

3 أشهر لاحقا
Freidenker01 wrote

Its also worth noting that Spine does actually have a Binary format export that could load orders of magnitude faster when implemented in the Unity runtime.

The Binary format is very useful for any professional level project . But how to use Spine Editor export the binary format files and import to the runtimes in unity ? I can't find any API or documents .

Binary is not yet available for Unity, so that's unfortunate

Posted something to try and help out here along the lines of what Pharan and Mitch were indicating you should do...

viewtopic.php?f=7&t=3587

Rob

I know it , but it is not enough . It's still parser JSON for a long time when instantiate skeletonAnimation in the first time . I notice that the idea has implemented https://github.com/nitrobin/spinehx/blob/master/src-base/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java 2 years ago . But why not to import it in the runtimes ? What is your plan for the next step ? And what should I do now ? 🙁

شهر واحد لاحقا

Sorry for the delay in getting back to you.

Unfortunately I'm not much of a programmer so I can't help you with this specific case. I can tell you why the binary isn't updated however.

Each time the runtimes are updated, the binary also needs to be updated. Due to the amount of changes and additions we've made to Spine over the last years it wouldn't be feasible to keep the binary runtime up to date with the JSON version. This will change as soon as the runtimes are pretty much locked down. I can't say when it will happen though. Hopefully sooner than later.