Receive a callback to client from Cloud Code when a C# module is invoked via a trigger.

I am following the example in the guide and I have a question. How can I receive a callback from a C# module in Cloud Code when default configuration values have been set?

Here’s what I mean:

  • A trigger calls Cloud Code (a C# module).
  • In Cloud Code, the method InitializeNewPlayer is called:
await gameApiClient.CloudSaveData.SetItemBatchAsync(ctx, ctx.ServiceToken, ctx.ProjectId, playerId,
                    new SetItemBatchBody(new List<SetItemBody>{new (HealthKey, DefaultValue), new (StaminaKey, DefaultValue)}));
  • Upon completion of the method in Cloud Code, I want to update the player’s data in Unity by calling
var playerData = await CloudSaveService.Instance.Data.Player.LoadAsync
  • This is to ensure that the player sees updated data in the game. Is there any callback mechanism available from the Cloud Code module other than sending a push message with await pushClient.SendPlayerMessageAsync? Are there any other options available?

I"m super new to this, but it looks like Cloud Save emits an event when an item is updated
Supported UGS events (unity.com)

1 Like

Hi @ByteflowX

Edit - provided an answer, but then I saw you’d already mentioned it in your point 4. Using the push client is the only mechanism we currently provide as part of Cloud Code - what other options/ features were you hoping to use that the push client doesn’t provide?

Push notifications suit me well, thank you!