Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question a few questions regarding the use of pushClient.SendPlayerMessageAsync

Discussion in 'Cloud Code' started by Kurutah, Apr 16, 2024.

  1. Kurutah

    Kurutah

    Joined:
    Jul 19, 2017
    Posts:
    11
    Hello! Here are a few questions regarding the use of pushClient.SendPlayerMessageAsync (I couldn’t find answers in the documentation).
    1. If a player was offline at the time the message was sent, will they receive it when they come online? If so, how long do they have a chance to receive this message?
    2. If some data is transmitted along with the message, are there any restrictions on it?
    Thank you.
     
  2. samg-unity

    samg-unity

    Unity Technologies

    Joined:
    Mar 23, 2021
    Posts:
    45
    Hi @Kurutah

    > If a player was offline at the time the message was sent, will they receive it when they come online?

    The player would have to be connected at the time to receive the message. As we do not currently provide message history as part of the push messaging feature they would not receive the message if they were offline.
    You could look at storing the messages in Cloud Save, then the push message could be used to simply trigger a fetch of the messages from Cloud Save. If the user was offline then when they next log in they can send a Cloud Save request for any missed messages as part of the logging in process.

    > If some data is transmitted along with the message, are there any restrictions on it?

    The push messages currently have a 10kb limit (via https://docs.unity.com/ugs/en-us/manual/cloud-code/manual/modules/reference/limits#Push_messages)
     
    Kurutah likes this.