実現したいこと
メニューシーンとゲームシーンがあり
メニューシーンでボタン1が押されると、ゲームシーンに移動して
オブジェクトが生成され、
オブジェクトが存在する限り、
メニューシーンのボタン1が押せなくなる
というプログラムを製作したい。
発生している問題・分からないこと
実現方法が分かりません。
該当のソースコード
public class メニュースクリプト : MonoBehaviourPunCallbacks { public static int Number; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { Number = 0; } // Update is called once per frame void Update() { } public void Button1() { Number = 1; SceneManager.LoadScene("ゲームシーン"); } }
public class オブジェクト生成スクリプト : MonoBehaviourPunCallbacks { // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { PhotonNetwork.ConnectUsingSettings(); } public override void OnConnectedToMaster() { PhotonNetwork.JoinOrCreateRoom("room", new RoomOptions(), TypedLobby.Default); } public override void OnJoinedRoom() { int Number = メニュースクリプト.Number; if (Number == 1) { //キャラクターを生成 GameObject G = PhotonNetwork.Instantiate ("A", transform.position,Quaternion.identity); } } }
特になし
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
結果は実現不可能でした。
補足
特になし