Object not synchronized for all clients

I'm new to this forum, I hope I've posted this under the right topic.


Hello everyone, I'm having sync issues on the project I've been working on recently. My game has a playground system (players start taking damage if they are outside the playground). My problem starts after that. I programmed the playground system and placed it on my stage for the first test. Players have joined the game and the sync is successful. But when the master client leaves the game, all synchronization is broken. What I can't understand is why master client is controlling every object?. What I want is for the playground to exist on stage and just send the same transform data to all clients. If I were to describe the playground system, it is a randomly created system. It is created in different shapes and locations each time and gets smaller as time goes on. I tried many different solutions, calling with RPC, trying my own sync system but none of them solved my problem. My objects have Photon View and transform view. Thank you for your help. I'm sorry for my bad english.

Answers

  • Is there anyone who can help ?

  • if a game object with a photon view is sitting in the scene when it starts, its default owner is the master client, i believe. for networked objects created with PhotonNetwork.Instantiate, whoever calls the instantiation becomes the owner of that object. if an object's owner leaves, it goes to the master. if the master leaves, a new master is selected and everything it owner transfers to that user. this is probably where your game logic is broken. you can check for which client becomes the new master client with the callback OnMasterClientSwitched (Player newMasterClient) and then you can try to figure out what to do.

  • Thanks for your support, I tried using the OnMasterClientSwitched (Player newMasterClient) call before but nothing changed. Apart from these, can I set any object created by the master client that has Photon View on it as a master client? This doesn't work as far as I've tried. However, a player with a photon view can be set as a master client. Why can't other objects be set as Master client while players can be set? Is it because each of the players has been added to the player list?