Photon Network RPC Random Range Problem
Hi, I'm working on a project. I'm using this script for bot money;
using UnityEngine;
using System.Collections;
public class Botmoney : MonoBehaviour {
public int BotMoney;
public bool botStealable = true;
PhotonView photonView;
// Use this for initialization
void Start () {
photonView = GetComponent ();
photonView.RPC ("RandomMoneyFBot", PhotonTargets.All);
}
[RPC]
void RandomMoneyFBot(){
BotMoney = Random.Range (12,60);
}
}
But every client gets diffrent numbers. How I can solve this?
Also;
When I want RPC to a string with PhotonNetwork.playerName every player gets their own player name. I want to just write RPC sender's name to string. How can I do this?
Hi, I'm working on a project. I'm using this script for bot money;
using UnityEngine;
using System.Collections;
public class Botmoney : MonoBehaviour {
public int BotMoney;
public bool botStealable = true;
PhotonView photonView;
// Use this for initialization
void Start () {
photonView = GetComponent ();
photonView.RPC ("RandomMoneyFBot", PhotonTargets.All);
}
[RPC]
void RandomMoneyFBot(){
BotMoney = Random.Range (12,60);
}
}
But every client gets diffrent numbers. How I can solve this?
Also;
When I want RPC to a string with PhotonNetwork.playerName every player gets their own player name. I want to just write RPC sender's name to string. How can I do this?