How to change color of a scene object, by server + clients

Hello I am comparing multiple Network Sulotions of this basic things. I am not really fan of authority systems. This makes me headache somtimes.

With Photon Pun this is really easy.

I am just using simple example. My goal is, that I want to do something clientside which cannot be seen on the server.. but send to server that I am doing this ( I hope this is correct.. look at code for more). So the server can sync this between other clients. Lets say we want to use it on Doors and we call the script Door.cs

I already tested with UNet. This does not work really there. Command cannot be sent from all clients.. only if you own that object.
    
Door.cs

   // Client has cursor on a object
    void OnMouseEnter()
    {
	// send to all that someone has mouse over object
        view.RPC("OnHoverEnter", PhotonTargets.All);
    }
	
   // Client moved out the cursor
    void OnMouseExit()
    {
	// send to all that someone moved out the cursor
        view.RPC("OnHoverExit", PhotonTargets.All);
    }

    [PunRPC]
    void OnHoverEnter()
    {
	// Example later implement CanPlayerDoThis()
	// Maybe Team A can do this but not Team B
        GetComponent<MeshRenderer>().material.color = new Color(1, 0, 0, 1);
    }

    [PunRPC]
    void OnHoverExit()
    {
	// Example later implement CanPlayerDoThis()
	// Maybe Team A can do this but not Team B
        GetComponent<MeshRenderer>().material.color = new Color(0, 0, 0, 1);
    }
As you can see in the code I have an gameobject and I change the material color if I the cursor of the client OR server is on the object. This works in PUN very well.
Now I can say on every Script GetComponent().OpenDoor() and the OpenDoor would have the rpc call.

Now with UNet I have to be instantiante NetworkIdentity owner. From this object I need to use Commands and say something like

Player.HoverEnterGameObject(GameObject obj)
Player.HoverExitGameObject(GameObject obj)
I think this is really horrible for coding. Imagine I need to make it for many many many different Kind of GameObjects. So I cannot make it easy and define functions on the GameObject itself to Kall it later like doorInstance.CmdOpenDoor(). Or in this case doorInstance.CmdOnHoverEnter() -> Error -> no authority.

Now I am at Bolt. I am trying this. From reading the documentation it shouldn't work. And yes it didn't work. I get message something like I am not the owner.

Well now I wanted to ask is there other easy why like Photon PUN or do I need really make something like I said with UNet?

Comments