Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UNET Buffered RPC to new clients?

Discussion in 'UNet' started by eaquino_unity, Apr 21, 2020.

  1. eaquino_unity

    eaquino_unity

    Joined:
    Aug 13, 2019
    Posts:
    13
    Hi,

    I am working with Unet and planning to migrate to Mirror.

    I have a question or rather a problem that I don't know how to solve and I was wondering if they could support me.

    I have a server with 5 clients connected, the server plays a video or an audio and they can all be seen / heard synchronously, but what happens if a client joins the server and then 2 and then 3? How do I get those 3 clients to sync up with everything that's happening on the server? that is, from the position of the clients, the methods they are executing or let's go to something simpler, how do I make a new client connect when it synchronizes with the current playing time of the video or background music?

    Previously I was working with photon and this could be solved using Buffered RPC to new clients and thus they were able to synchronize with what happens in the server or the room. In UNET I can't find anything about it, when the new clients connect to the server they don't synchronize and my solution to join the server is by resetting the scene.

    Could someone guide me or support me with this?

    Tanks!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Unet never had buffered RPC unfortunately. It does have TargetRPC, so on connect you can send just that client specific RPC's.

    I'd sync as much as possible using SyncVars, since the new client always gets the current value, and use TargetRPC for the things where they make sense.