Accessing other players data

Is cloud save supporting accessing other player data?

Simple use case:
I have simple friend list. In player data I have list of string with other players ids.
With Cloud Code script I can call FetchFriends that would fetch extra information like name and level from other players, and return the new list with full into about friends.

Would that be correct way of doing it?

Also based on the docs, data is always tight to player id. Is it possible to use Cloud Save as global database slot, for example leaderboards, where more players can read from?

1 Like

Hi Aixa,

Thank you for your question, this is a really good point. Cloud Save & Cloud Code currently only supports access to the data of the player who makes the request.

We do however realise that this is limiting, especially in situations as you mentioned. This is high on our to-do for the beta product and when we figure out how to do this in a secure way you will be able to have both, access to any player’s data and store global data. This will resolve both your use cases. Watch this space!

3 Likes

ok, that’s good to know and thanks for your response
Will be checking the updates as they come :slight_smile:

Hi,
It’s good to know these upcoming features. But is there any timeline or future planning for these features to arrive at cloud save?

Hello,

sorry for undigging this, but I have a similar issue, is there any good solution within Unity Services for this problem?

I want the players to be able to get a save from host to which they are connecting to - with being able to just download the data from host Authentication ID then it would be all I want.

Thanks,

Hi DeGenerals,

Don’t be sorry :slight_smile: we really appreciate your feedback, suggestions and questions.

Can you provide a little more information or clarification on the use case you are trying to implement?

Are you saying that multiple players are connecting to a host player and you want them to load the hosts save data? Is the purpose of this for connecting players to access the host players state (e.g. XP, Strength etc…) or is it more about accessing a persistent world or level state?

Thanks,
L

1 Like

Hello,

the answer is the latter, to get the state of the world, let me explain better:

  1. This is a multiplayer coop game made in PUN 2
  2. The save state contains information about player team resources, force pool, units etc. (this is a WW2 tank game) during a campaign.
  3. Players can join such game in any moment, during battles or during special segments of repairing and managing.
  4. A single game can last for few hours, as in a single campaign there will be few battle missions, separated by repair section game mode.
  5. To properly synchronize everything when players join the room they need to get the game state from the host. This is stored by Easy Save 3 .json file (around 50-100 kb file).

Thanks,

1 Like

I am wandering that how you received other players data from cloud save using their player ids

Hi, for anyone still looking.
Retrieving another player’s data using their id.
Please see the explanation in the docs Unity SDK tutorial

public async void LoadPublicDataByPlayerId()
{
  var playerId = "JE1unrWOOzzbIwy3Nl60fRefuiVE";
  var playerData = await CloudSaveService.Instance.Data.Player.LoadAsync(new HashSet<string>{"keyName"}, new LoadOptions(new PublicReadAccessClassOptions(playerId)));
  if (playerData.TryGetValue("keyName", out var keyName)) {
      Debug.Log($"keyName: {keyName.Value.GetAs<string>()}");
  }
}
2 Likes