Hello, I’m using PhotonNetwork but I’m starting on the plugin, I done a simple scene, when players join on a room and enter on the scene, he can click on an box, and a variable int will count how much clicks the player done.
The problem is that my variable is unique per player, so when I click only the client see, but another players dont see how much clicks the other player done.
Here my script:
using UnityEngine;
using System.Collections;
public class ClickToCount : MonoBehaviour
{
int clicks;
PhotonView photonView1;
public void Awake()
{
// PhotonNetwork.automaticallySyncScene = true;
}
void OnMouseDown ()
{
print("foAi");
if (transform.gameObject.tag == "Player")
{
clicks++;
print("foi");
}
}
void OnGUI()
{
foreach (PhotonPlayer bucetao in PhotonNetwork.playerList)
{
GUILayout.Box(bucetao.name + ":" + clicks);
}
}
}
Here is a print for easy understand, each guest is one player, if I click all players cont 1 click but only for this client (on other player client the count still 0 if he dont click).