Spawn objects don't spawn the same for both players
Options
I am trying to do a multiplayer game using photon and when I try to spawn objects near my player , they don't sync the same for the both players . What I should add in the inspector (Already the both objects that need to be spawn have PhotonView and PhotonView Transform) . What I should add to my script?
using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; public class SpawnFix : MonoBehaviour { public GameObject[] powersPrefab; public Transform[] points; public float beat = (60 / 130) * 2; private float timer; // Start is called before the first frame update void Start() { } // Update is called once per frame [PunRPC] void Update() { if (timer > beat) { GameObject powers = Instantiate(powersPrefab[Random.Range(0, 2)]); powers.transform.localPosition = points[Random.Range(0, points.Length)].position; timer -= beat; } timer += Time.deltaTime; } }
0