How would I go and change the number of users/skeletons Nuitrack may track during runtime?
Depending on which game I start, I want to change this amount. I found the function:
skeletonTracker.SetNumActiveUsers(_trackableAmount);
But this does not appear to work. If I put it on 1, and the second user walks into the frame, Unity3D crashes.
I use a get/setter for this and change it from another script.
Example:
public int TrackableAmount {
get { return _trackableAmount; }
set
{
_trackableAmount = value;
skeletonTracker.SetNumActiveUsers(_trackableAmount);
}
}
En then i set it from another script using:
public void SetPlayerAmount(int amount)
{
InputManager.TrackableAmount = amount;
}
If I put the amount on 2, We can play the game with 2 people, If I put the amount on 1, the first person goes right, but when a second person walks into the screen the model for this person gets activated through the onnewuserevent, and then Unity crashes. Meaning that eventhough I set it to 1 user, it still gets into a newuserevent when someone else walks into the screen.
Idk what the problem is, it finds a second user but then crashes somewhere? Maybe because I said the numactiveusers to 1 through the skeletontracker, meaning it may not track someone else, but then it finds a second person? Idk…
Any ideas?
To clarify: I want to be able to specify the number of players a game can/may have per game through a setting.