Как в Unity 3d синхронизировать переменную через Photon pun 2
Есть случайная переменная, но при подключении второго игрока у него она отличается от хоста.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandMonster : MonoBehaviour
{
public static RandMonster instance;
public int money = 0;
public int monster = 1;
private void Awake()
{
instance = this;
}
public void Start()
{
monster = PlayerPrefs.GetInt("monster", monster);
monster = Random.Range(1, 7);
PlayerPrefs.SetInt("monster", monster);
}
}