The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

PhotonNetwork.automaticallySyncScene = true explain please?

piginhat
2017-08-30 19:02:41

I have this line in my app: PhotonNetwork.automaticallySyncScene = true

So I presumed this means scenes are synced between all?

So when I have created and joined a room as master and then the client joins I thought if master called a method to hide a specific canvas this would propagate to all, but it does not it only hides on master?

I tried adding a PhotonView to the canvas but this just observes the rect transform not the active state?

Comments

[Deleted User]
2017-08-31 09:07:26

HI @piginhat,

I guess you misunderstood PhotonNetwork.automaticallySyncScene. It doesn't mean, that the state, position or something else of all availabe objects are synchronized - unless you are doing that on your own. It means that the currently loaded scene is the same across all clients, if the MasterClient used PhotonNetwork.LoadLevel to load another scene. For example if the MasterClient loads Scene B, all other clients will load Scene B as well.

piginhat
2017-08-31 10:51:43

Ah, OK thanks. So is there no way I can control the active state of a canvas across players? I see the PhotonView will only observer the rect transform but not the active state.

What do other folks do?

Thanks

[Deleted User]
2017-08-31 11:21:09

You can control this. If you have already attached a PhotonView component to it, the object will be controllable by the MasterClient and he can send RPCs for example. Another option would be raising an event by calling RaiseEvent. Even using OnPhotonSerializeView would work, but this is not recommended in this case because you don't have frequently changes.

piginhat
2017-08-31 13:43:28

Ok, so in my situation I have this:

A canvas that has a master view panel and a client view panel.

Master logs on and creates a room and sees the master view panel, client logs in and joins the room and sees the client view panel.

Master starts the game and sets the master view panel and client view panel to hide so now both players see the game scene etc.

There is a "Leave Game" button that when the client taps it I intended to make the client view panel appear on the clients device whilst the master still sees the game scene.

If howver the master taps the leave game button then it sets both master view panel and client view panel to show so now both are back at the start.

Am I misunderstanding completely?

I did start to work through the PUNBasic Tutorial but that seems a bit off topic / hard to follow so I followed a YouTube series that "I think" got me a good way into using PUN.

I really wish there was an up to date step-by-step video on PUN from the PUN team available. Even better would be an official book ...

I'm amazed at what PUN can do, just think I am missing the plot a tad :neutral:

[Deleted User]
2017-08-31 15:50:36

Master logs on and creates a room and sees the master view panel, client logs in and joins the room and sees the client view panel.

Good, we have an entry point and this sounds good so far.

Master starts the game and sets the master view panel and client view panel to hide so now both players see the game scene etc.

Do you already have this working? If not you can either use a RPC on the game object (if it has an attached PhotonView component) telling all clients to disable it or you can use RaiseEvent with a unique EventCode. When using RaiseEvent the game object doesn't need a PhotonView component.

There is a "Leave Game" button that when the client taps it I intended to make the client view panel appear on the clients device whilst the master still sees the game scene.

You can do this locally on the client. I thing there is no need to synchronize this action in this case.

If howver the master taps the leave game button then it sets both master view panel and client view panel to show so now both are back at the start.

You can do this the same way you previously disabled the view. RPC or RaiseEvent.

Hope that makes things more clearly for you. If you have further questions, feel free to ask.

piginhat
2017-08-31 18:14:51

Thanks, really appreciate the feedback! I am revisiting the PUN Basic tutorial to see if I can complete it and hopefully fill in some blanks.

But you answer helps no end :) :)

Hipshot
2018-07-27 22:13:14

@Christian_Simon wrote:

You can control this. If you have already attached a PhotonView component to it, the object will be controllable by the MasterClient and he can send RPCs for example. Another option would be raising an event by calling RaiseEvent. Even using OnPhotonSerializeView would work, but this is not recommended in this case because you don't have frequently changes.

Does this work in editor? I am setting PhotonNetwork.automaticallySyncScene = true in the start function of my connect and join script. The scene changes for the master, but not the client in editor?

S_Oliver
2018-07-28 14:30:40

@Hipshot you have to change/load the scene with PhotonNetwork.LoadLevel

Back to top