質問編集履歴

2

member

2017/10/17 19:13

投稿

kaji
kaji

スコア648

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  Quaternion.Euler(Vector3.zero),0);
48
48
 
49
- member.name = "Member"+cube.GetComponent<PhotonView>().ownerId;
49
+ member.name = "Member"+member.GetComponent<PhotonView>().ownerId;
50
50
 
51
51
  ```
52
52
 

1

tasu

2017/10/17 19:13

投稿

kaji
kaji

スコア648

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,69 @@
32
32
 
33
33
  以下のようにデータを送ってます。
34
34
 
35
+
36
+
37
+
38
+
39
+ #PhotonManager.cs
40
+
35
41
  ```ここに言語を入力
42
+
43
+
44
+
45
+ GameObject member = PhotonNetwork.Instantiate ("Member", new Vector3 (0.0f, 0.0f, 0.0f),
46
+
47
+ Quaternion.Euler(Vector3.zero),0);
48
+
49
+ member.name = "Member"+cube.GetComponent<PhotonView>().ownerId;
50
+
51
+ ```
52
+
53
+
54
+
55
+ #MemberScript.cs
56
+
57
+ ```ここに言語を入力
58
+
59
+
60
+
61
+ using System.Collections;
62
+
63
+ using System.Collections.Generic;
64
+
65
+ using UnityEngine;
66
+
67
+
68
+
69
+ public class MemberScript : Photon.MonoBehaviour {
70
+
71
+
72
+
73
+ public string str = "hoge";
74
+
75
+ // Use this for initialization
76
+
77
+ void Start () {
78
+
79
+
80
+
81
+ }
82
+
83
+
84
+
85
+ // Update is called once per frame
86
+
87
+ void Update () {
88
+
89
+
90
+
91
+ }
92
+
93
+ void Awake() {
94
+
95
+ this.name = "Member"+GetComponent<PhotonView> ().ownerId;
96
+
97
+ }
36
98
 
37
99
  void OnPhotonSerializeView( PhotonStream stream, PhotonMessageInfo info )
38
100
 
@@ -40,7 +102,7 @@
40
102
 
41
103
  if (stream.isWriting) {
42
104
 
43
- Debug.Log ("isWriting="+str);
105
+ Debug.Log ("member isWriting="+str);
44
106
 
45
107
  //データの送信
46
108
 
@@ -48,18 +110,34 @@
48
110
 
49
111
 
50
112
 
113
+
114
+
51
115
  } else {
52
116
 
53
- Debug.Log ("isread="+str);
117
+ Debug.Log ("member isread="+str);
54
118
 
55
119
  //データの受信
56
120
 
57
121
  this.str = (string)stream.ReceiveNext();
58
122
 
59
- SetCubeText ();
123
+
60
124
 
61
125
 
62
126
 
63
127
  }
64
128
 
129
+ }
130
+
131
+ }
132
+
133
+
134
+
135
+
136
+
65
137
  ```
138
+
139
+
140
+
141
+ MemberObjectのinspector
142
+
143
+ ![イメージ説明](1ad9154f922933d733dcc07b22f203ee.png)