Sync. an object with all clients.

Hey, I'm new to Photon/Fusion and never had experience with Unity Multiplayer. To my question I want to activate a text when a Player joints a game.

I'm wondering, how to sync that with every player, so that every one can see that text.

In the moment, the text gets activated and gets assigned to a text variable of the player, but I can only see the text on the host/server side. Any tipps? Already tried network objects and photon view and rpc calls.


  • WARdd
    WARdd ✭✭

    I recommend you take a look at some example projects, since I reckon you will have a lot more similar questions.

    The easiest solution is to trigger a message in OnPlayerJoined. That has the downside that you won't have a player name to work with.

    If you want the player name to be included in the message you probably want to do some magic inside your player script: The client should send an RPC to server with the name they want to have. This RPC can be triggered in Spawned() and should be input -> state authority. Then you can trigger the message via OnChanged on the name string, which will be called on all clients. Finally you can Include a self check (Runner.localPlayer == Object.InputAuthority) to prevent the message from appearing for the player himself.

  • thanks for the advice, I will try it out!