This is the code that i'm currently using, i've tried may different logic but it's no use. Can someone please point out the problem? i think i'm using the RPC wrong.
public class GeneratingKey : Photon.MonoBehaviour {
int random;
string key = null;
string RandomKey = "";
void Start() {
if(PhotonNetwork.countOfPlayers == 1 && key == null)
{
for (int i = 0; i < 30; i++) {
random = Random.Range (1, 5);
RandomKey = RandomKey + random.ToString();
}
key = RandomKey;
}
if (key != null) {
ProceduralNumberGenerator.SetKey (key);
}
}
void Update(){
photonView.RPC ("SetKey", PhotonTargets.Others, key);
if (key != null)
Debug.Log (key);
ProceduralNumberGenerator.SetKey (key);
}
// Update is called once per frame
[PunRPC]
void SetKey (string tempString) {
if (key == null) {
key = tempString;
}
}
}
public class GeneratingKey : Photon.MonoBehaviour {
int random;
string key = null;
string RandomKey = "";
void Start() {
if(PhotonNetwork.countOfPlayers == 1 && key == null)
{
for (int i = 0; i < 30; i++) {
random = Random.Range (1, 5);
RandomKey = RandomKey + random.ToString();
}
key = RandomKey;
}
if (key != null) {
ProceduralNumberGenerator.SetKey (key);
}
}
void Update(){
photonView.RPC ("SetKey", PhotonTargets.Others, key);
if (key != null)
Debug.Log (key);
ProceduralNumberGenerator.SetKey (key);
}
// Update is called once per frame
[PunRPC]
void SetKey (string tempString) {
if (key == null) {
key = tempString;
}
}
}