Here is my code
using UnityEngine;
using System.Collections;
public class StarCreate : Photon.MonoBehaviour {
public GameObject prefab;
public int StarCount;
// Use this for initialization
void Start () {
GetComponent ().RPC (
"UniCreate",
PhotonTargets.All);
}
[RPC]
void UniCreate (){
StarCount = Random.Range (100, 200);
int i = 0;
while (i < StarCount) {
Instantiate(prefab, new Vector3 (Random.Range (-10000,100000), Random.Range (-10000,100000),Random.Range (-100000,100000)), Quaternion.identity);
i++;
}
}
so I was wondering how you sync Random Numbers over the network though rpc! The problem is that every client gets the prefab instantiated in a different place! I want the Prefab to be instantiated in a random area but the same for every client though! That's all thanks for the help (BTW I did search the web for solutions to this but could not find any similar to my problem, so I I'm not that lazy XD).
↧