In this section you will learn how to manage the user groups.
Create a new group
You can create a new group with UserGroup.Save (call this also to edit a group that was loaded):
UserGroup group = new UserGroup();
group.name = "My Group";
group.users = new User[] { {userName="OtherUser1"}, {userName="OtherUser2"} };
group.Save((bool success, string error) => {
Debug.Log("Group saved: " + success);
});
Load groups
To load groups you have 3 choices:
Join a group
You can join a group with UserGroup.Join:
group.Join((bool success, string error) => {
Debug.Log("Group joined: " + success);
});
group.Join(new string[] {"user1"}, (bool success, string error) => {
Debug.Log("Group joined: " + success);
});
Leave a group
You can leave a group with UserGroup.Leave:
group.Leave((bool success, string error) => {
Debug.Log("Group joined: " + success);
});
group.Leave(new string[] {"user1"}, (bool success, string error) => {
Debug.Log("Group joined: " + success);
});