Thanks Nate, we'll look into that!
A DOTS implementation would be awesome!
Hi, just wanted to report what the optimizations where and what we were able to trim the numbers down to. Was wondering if this gives anymore insight on your end. Thank you!
Thanks Nate, we'll look into that!
A DOTS implementation would be awesome!
Hi, just wanted to report what the optimizations where and what we were able to trim the numbers down to. Was wondering if this gives anymore insight on your end. Thank you!
Thank you! We have done a test with removing the paths and it does help performance a bit. In theory we could have the animator reanimate them all, but that would take a long time (something we just don't have a lot of haha). We also did a test with prune and the animator had even removed vertices that were in use to lower the count, but it didn't give us noticeable gains.
We are using spine 3.8 and I see 4.0 is in beta. Are there notable improvements to performance in there and would it be worth upgrading to get those improvements? We could of course try it, but just wanted your thoughts on it.
I've attached the metrics view of one of the agent's forward facing skeleton.
We are using path constraints, but not sure what "a lot" would be. I did confirm with the animator they use path constraints all over the place.
Hi! Thank you for the response!
Apologies for the confusion. GDK (short for Microsoft Game Development Kit) is the new build pipeline for XBox One, XBox Series, and Windows 10 from Microsoft. It is their replacement for XDK and UWP pipelines.
I will take a look at that link, thank you for sharing!
I have done profiling. I found that most time is spent in Update() which calls Skeleton.UpdateWorldTransform() which calls PathConstraint.Update().
I did see that post you linked, and I think we are already using IL2CPP, but I will double check.
Update to confirm we are indeed using IL2CPP. However, upon reading the thread again, I see there are levels. I will with different optimization levels
update update, there is no optimization level for this build pipeline. I was confusing one of the options with optimization.
Hello! I have a game running on Xbox One using GDK. I have 25 spine animations on screen and I'm noticing a non-trivial performance impact. The game runs at 60+ fps without them and around 30 fps with them.
I do have code in my project to update spine files offscreen at a lower frame rate (by manually calling Update(); and LateUpdate() with a larger deltaTime and load balancing those update calls across frames), but again those are for off screen spine files. For all spine files on screen, I let their on Update(); and LateUpdate(); get called through the normal flow
Should I be observing performance degradation with 25 spine animations on Xbox One using GDK?
Thanks in advance!
Thank you Harald! That solved my problem. I called Update(0); LateUpdate(); when enabling the specific SkeletonAnimation.
The Setup:
I have a GameObject with 4 children. Each child has a SkeletonAnimation and MeshRenderer. This children correspond to facing directions (up, down, left, & right). A script in the parent controls which of these meshes are turned on depending on which way the character is facing.
A separate singleton script, which holds a reference to that top-level GameObject , is responsible for calling Update(dt) and LateUpdate() at the appropriate time on each SkeletonAnimation.
We have code to attach a Sprite to the skeleton
void attachSpriteToSkeleton(SkeletonAnimation _skelAnim, MeshRenderer _mesh, Slot _slot, Sprite _sprite)
{
if (_skelAnim == null) {
return;
}
//Get handle to a few things that we'll be using it a lot
var skel = _skelAnim.skeleton;
string slotName = _slot.Data.Name;
string newAttachmentName = _sprite.name;
//All attachment changes will be applied to the skin. We use a clone so other instances will not be affected.
var newSkin = skel.UnshareSkin(true, false);
//Create an attachment from a Unity Sprite
var newAttachment = _sprite.ToRegionAttachmentPMAClone(_mesh.material);
//Add the attachement to the slot
int slotIndex = _skelAnim.skeleton.FindSlotIndex(slotName);
newSkin.SetAttachment(slotIndex, newAttachmentName, newAttachment);
//Set the skin to the one we made, and then make our attachments visible.
//Note that any keying to the slot in the anim will still be recognized, so make sure that's all good to go!
skel.SetSkin(newSkin);
skel.SetToSetupPose();
skel.SetAttachment(slotName, newAttachmentName);
}
and to unattach
void unattachSpriteFromSkeleton(SkeletonAnimation _skelAnim, Slot _slot)
{
if (_skelAnim) {
var skel = _skelAnim.skeleton;
skel.SetSlotAttachmentToSetupPose(skel.FindSlotIndex(_slot.Data.Name));
}
}
Any time we want to attach or unattach, we call this code on ALL the SkeletonAnimations (regardless of whether it's currently rendering or not)
Now to the actual setup. The game launches with the character facing Left. We call the attachment code on all 4 our SkeletonAnimations to have our character pickup a stick. Then on some user input, we have the character drop the stick. When that character faces any other direction, I'd expect to not see the character holding the stick. This is actually what plays out with the setup I've described above
The Issue:
I've put in some logic to prevent all the SkeletonAnimations from Updating/LateUpdating by simply checknig if their renderer is enabled. Once I did this, I noticed that after dropping the stick, and turning another direction, the character shows as holding the stick for one frame before going back to the expected animation. I've attempted to call Update(dt) and LateUpdate() immediately after calling the attach/unattach code, but that doesn't seem to solve my problem either. I was wondering if anyone could help with this.
please let me know if anything needs clarification, I know this is super long winded.
Thank you!