Combu  2.1.14
Unity API Documentation
Managing User Groups

Table of Contents

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:

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);
});