How to keep multiple skeleton ID in Unity?

Inside my Unity project, multiple skeletons will be applied with different effects, (e.g. particle system/animation on models), I’ve already kept each skeleton on their position, but I can’t keep their ID when a new user comes in and out, because I want to apply effects to each different skeleton. This causes problems when one of the multiple users leaves out the range of camera and all the effects on the other skeletons will re-initialize again.

Is it because of any of the user leave the “skeletonData.Skeletons[i]” (“i” insides the for loop stands for userID) , the ID of the first skeleton will automatically assign to the second skeleton?

(Effect works well on one RiggedAvatar, if one user leaves the scene, the effects on the other user will active again)

(Unity 2019.2.11, Intel RealSense D435i)
Thanks for any help!

In the skeletonData.Skeletons array, the order of skeletons can change. To bind to a specific user, you should use Skeleton.ID.
For example, if (skeletonData.Skeletons[i].ID == main_user_id) ... .

1 Like