Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question How to use Cloud Save to create player guilds/clans?

Discussion in 'Cloud Save' started by CameronDWills, Apr 21, 2024.

  1. CameronDWills

    CameronDWills

    Joined:
    Feb 26, 2021
    Posts:
    91
    I noticed in the documentation, the newly added features that allow players to add to 'game data' saved in Unity cloud can be used to facilitate player guilds, but I didn't see any examples of this and am struggling to figure out what would be the best practice to make something like this.

    I'd imagine it would be something like a Cloud Code script to 'create a clan' by writing to the game data value for Clans, and then maybe that value containing a json list of all created clans and their members?

    Does anyone know what the best practice would be for having player clans?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,137
    Have a list of clans, at the most basic level a List<string> although you‘ll surely want a custom struct to allow for extra data like when the clan was created, which players have admin roles, etc.

    Players are assigned a ClanIndex which is an index into this list.

    You need to take into account that a player’s clan may have been deleted. And allow clan leaders to add or remove clan members.

    It‘s just a starting point but the basics are really just about assigning a clan index to players and managing a clan (team, guild, etc) list of custom data.
     
    CameronDWills likes this.