Scissor

I use asynchronous loading for spine datas. ( json, atlas, png ).
But when first time creating spine, it still cause lag in SkeletonRenderer LateUpdate().
One for about 250ms delay, 10 for 2.5 seconds delay. :'( :'( :'(

Code snippets:
var obj = new GameObject();
var animation = obj.AddComponent<SkeletonAnimation>();
animation.skeletonDataAsset = asset;
// ... something else
// Big lag: Call SkeletonRenderer LateUpdate()
animation.Reset();
Unity Version: 4.6.0f3

I have found that someone with the same question in this post:
http://esotericsoftware.com/forum/Unity-SkeletonRenderer-rebuilds-everything-each-frame-4466?p=21465&hilit=lateupdate#p21465

This problem has bothering me several months, is there a good solution yet? :think: :think: :think:
Thank you!
Scissor
  • Mesajlar: 3

Pharan

In what way are you doing asynchronous loading?
Note that it's not enough to "load" the SkeletonDataAssets through LoadAsync or something.
You need to make them generate the Skeleton objects during your load phase/load scene.
You do this by calling, on each of them, something like:
mySkeletonDataAsset.GetSkeletonData(false);
This method lazy-instantiates the actual skeleton data, and triggers the reading of the json/binary files.

You may also need to tell Unity to preload the materials/textures too. I'm not sure how to do that, but that's a Unity thing. You can probably search the Unity forums for that. I've never done it myself.

I also think that thread you linked has little to do with your problem. (but in case you're interested, some 20 to 40% mesh-updating performance gains are being worked on. Someone just contributed some changes to the code that works around some weird stuff Unity does.)
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

ProudLittlePinwheel

Pharan yazdı:but in case you're interested, some 20 to 40% mesh-updating performance gains are being worked on. Someone just contributed some changes to the code that works around some weird stuff Unity does.
I was wondering, are the 20-40% mesh updating improvements mentioned going to be merged soon before any big Spine 3.0 update or are they integral to that? It's just that I'm not sure everyone will be able to update to 3.0 straight away (due to the massive skew scaling changes introduced) but may still want those performance improvements in their runtime. Any info on this would be appreciated?

Also, if more info on the 'weird stuff' Unity is/was doing is possible that would be great too, just for our own education to ensure we avoid such things in future.

Many thanks :)
ProudLittlePinwheel
  • Mesajlar: 45

Scissor

Pharan, thanks for your patient reply!
I just find out that the big lag occur in ReadSkeletonData() in SkeletonJson.cs
while deserializing json:
public SkeletonData ReadSkeletonData ( TextReader reader ) {
...
// Causing lag for larger file
var root = Json.Deserailize( reader ) as Dictionary<String, Object>;
...
}


I'll try do this stuff in background to solve problem.
Thank you! :) :) :)
Scissor
  • Mesajlar: 3

Mitch

Kullanıcı avatarı
Mitch

Mitch
  • Mesajlar: 978

Scissor

It works fine !
Thank you Mitch for the information !
And thanks spine team for binary supporting, too ! :D :D :D
Scissor
  • Mesajlar: 3

ProudLittlePinwheel

ProudLittlePinwheel yazdı:
Pharan yazdı:but in case you're interested, some 20 to 40% mesh-updating performance gains are being worked on. Someone just contributed some changes to the code that works around some weird stuff Unity does.
I was wondering, are the 20-40% mesh updating improvements mentioned going to be merged soon before any big Spine 3.0 update or are they integral to that? It's just that I'm not sure everyone will be able to update to 3.0 straight away (due to the massive skew scaling changes introduced) but may still want those performance improvements in their runtime. Any info on this would be appreciated?

Also, if more info on the 'weird stuff' Unity is/was doing is possible that would be great too, just for our own education to ensure we avoid such things in future.

Many thanks :)
So any word on this? Pharan... Anyone... :'(
ProudLittlePinwheel
  • Mesajlar: 45

Pharan

Ask your mother. (Mitch is your mother.)
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

ProudLittlePinwheel

Pharan yazdı:Ask your mother. (Mitch is your mother.)
Any info Mitch?
ProudLittlePinwheel
  • Mesajlar: 45

Mitch

Merged last night. didn't forum announce it yet.

unity package is updated too.

(Pharan is your grandmother)
Kullanıcı avatarı
Mitch

Mitch
  • Mesajlar: 978

ProudLittlePinwheel

Thankyou! :)
ProudLittlePinwheel
  • Mesajlar: 45

Pharan

You're welcome, sonny.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366

ZimM

It's actually more like 200-300% gain on desktop :p Not so much on mobile, though.
Kullanıcı avatarı
ZimM
  • Mesajlar: 25

Mitch

ZimM yazdı:It's actually more like 200-300% gain on desktop :p Not so much on mobile, though.
So far it's depended on the contents of my skeletons heh. Either way - thanks :)
Kullanıcı avatarı
Mitch

Mitch
  • Mesajlar: 978

ProudLittlePinwheel

Yeah it is a tonne faster for me. Awesome stuff!
ProudLittlePinwheel
  • Mesajlar: 45

Pharan

Just to clarify to late readers, OP's problem was totally different.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366


Dön Unity