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

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.

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.

sync variables

2017-03-22 01:25:00

I want all the variables for the player to be synced on all clients so the client can click on any player and see their stats. I thought this would be as simple as syncing them all when the player is first instantiated.

void Start () {
photonView.RPC("SetAll", PhotonTargets.All);

void SetAll () { =;
variables = variables;

It doesn't work, i can click on the enemies in the inspector and none of their variables have any values. The name isn't synced properly either, i have a UI element that displays the name of the gameobject you've clicked. How do i sync all variables on the gameObject across all players? These same gameobjects have their transform synced properly.


2017-03-22 02:32:26

void Start () {  
	string tempString = "gahgsahsgfahgsh";  
	photonView.RPC("SetAll", PhotonTargets.All, tempString, (int)28);  

void SetAll (string tempString, int number) {  
	Debug.Log(tempString + " " + number);  

Some usefull tutorials for beginners:

2017-03-22 03:17:52

Splendid, thank you. I've found it INCREDIBLY hard to get started with Photon. I've coded a lot of stuff by myself by looking up examples and tutorials. Seems like i can never find anything useful about photon. Even something incredibly simple and necessary like "how to sync variables."

2017-03-22 11:20:37

In any networking solution you must specify which variables should be synced and how.
There is nothing hard. Just study sample projects + read documentation, or watch tutorials on youtube.

Back to top