Photon Remote Procedure Calls
There could be the case were some events are trigger within the online collaborative space and all the users need to be aware of it. Photon helps you with this requirement using the Remote Procedure Calls (RPC) where you can assign a callback function to a network thread that will be executed on all clients.
This tutorial assumes you already know how to import Unity XR tool kits and Photon Engine in your project. If you don't, please follow this tutorial and come back when you have your Photon environment configured.
In this example will create a remote procedure to change the color of a cube in the online collaborative environment.
Create world space canvas UI and add a button.
2. Add a script component to the UI canvas and called it NetworkingUi. Also add Photon View Component
3. Open the NetworkingUi script in your code editor and copy-paste the following code.
4. In your scene add a 3D cube and place it where all the other users can observe it and add a photon view component to it
5. Assign the Cube to the NetworkingUi component in the Unity Editor.
8. From now on, if any of the online users press the UI button, the cube will change color on all the clients.