実現したいこと
子オブジェクトの生成
発生している問題・分からないこと
PUN2を使って
生成したネットワークオブジェクトAの
子オブジェクトとして
ネットワークオブジェクトBを生成したい。
該当のソースコード
C#
1using UnityEngine; 2using Photon.Pun; 3using Photon.Realtime; 4 5public class PUNTest : MonoBehaviourPunCallbacks 6{ 7 8 // Start is called once before the first execution of Update after the MonoBehaviour is created 9 void Start() 10 { 11 PhotonNetwork.ConnectUsingSettings(); 12 } 13 public override void OnConnectedToMaster() 14 { 15 // "room"という名前のルームに参加する(ルームが無ければ作成してから参加する) 16 PhotonNetwork.JoinOrCreateRoom("room", new RoomOptions(), TypedLobby.Default); 17 } 18 19 public override void OnJoinedRoom() 20 { 21 if (Input.GetKeyDown(KeyCode.A)) 22 { 23 GameObject A = PhotonNetwork.Instantiate("Capsule1", transform.position, Quaternion.identity, 0); 24 } 25 26 27 if (Input.GetKeyDown(KeyCode.B)) 28 { 29 GameObject B = PhotonNetwork.Instantiate("Capsule2", transform.position, Quaternion.identity, 0); 30 } 31 32 } 33 // Update is called once per frame 34 void Update() 35 { 36 37 } 38} 39
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
Google等の検索や
ソースコードの変更での
得られた結果はありません。
補足
特になし
あなたの回答
tips
プレビュー