Combu  3.2.2
Unity API Documentation
Managing User Groups

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";
// Add some users
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:

  • load groups owned by local user
    UserGroup.Load(CombuManager.localUser.idLong, (UserGroup[] groups, string error) => {
    Debug.Log(groups.Length);
    });
  • load groups in which local user is a member (owners are also members)

    UserGroup.LoadMembership(CombuManager.localUser.idLong, (UserGroup[] groups, string error) => {
    Debug.Log(groups.Length);
    });

Join a group

You can join a group with UserGroup.Join:

// Join local user
group.Join((bool success, string error) => {
Debug.Log("Group joined: " + success);
});
// Join a list of users
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:

// Leave local user
group.Leave((bool success, string error) => {
Debug.Log("Group joined: " + success);
});
// Leave a list of users
group.Leave(new string[] {"user1"}, (bool success, string error) => {
Debug.Log("Group joined: " + success);
});