Photon enable/disable objects on all views?

Hi. I have added multiplayer to my game using Photon Cloud (PUN+).

My problem is, that when my script disables/enables an object, that does not happen on the other client’s view.

I know this is how Photon handles multiplayer, but what would be the best way of disabling/enabling gameobjects on both views/clients?

Thannks, Andreas.

I’m not sure from your description, how far you are in the process, so this may be somewhat unprecise.

In order to call methods etc., for a specific client, you need to check ownership. This can be pretty simple with PUN. The client who instantiates an object, will also be the owner of said object.
The check is performed by “photonView.isMine()”.

if(photonView.isMine()) {
   // do something for this specific client 
}

If however, you already are able to make changes, specific to the clients, then I’m guessing your issue is to make it apply it on the server, so that all other clients can see it.
This is typically done by either streaming the data through [serialization][1] or by using [Remote Procedure Calls (RPCs)][2]
OBS: I was unable to find the documentation for Photons own RPC methods, but they are very similar to Unity’s RPCs. Major difference is how you call it: instead of Network.RPC(“method_Name”, targets), you have to use PhotonView.RPC(“method_Name”, targets);

The Marco Polo tutorial found at [exitgames][3], gives a nice overview of how data streaming can be done, especially under the “Adding Animations” paragraph.

Hope this proves useful to you. Good luck :slight_smile:
[1]: Fusion Introduction | Photon Engine
[2]: Unity - Scripting API: NetworkView.RPC
[3]: Fusion Introduction | Photon Engine