FetchInstantiationData
How do I use Fetch Instantiation Data
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: NetworkingPeer.cs
Copy
2408 public object[] FetchInstantiationData(int instantiationId)
2409 {
2410 object[] data = null;
2411 if (instantiationId == 0)
2412 {
2413 return null;
2414 }
2415
2416 tempInstantiationData.TryGetValue(instantiationId, out data);
2417 // Debug.Log("FetchInstantiationData() instantiationId: " + instantiationId + " tempInstantiationData.Count: " + tempInstantiationData.Count);
2418 return data;
2419 }
File name: PhotonView.cs
Copy
91 /// This is the instantiationData that was passed when calling PhotonNetwork.Instantiate* (if that was used to spawn this prefab)
94 {
95 get
96 {
97 if (!this.didAwake)
98 {
99 // even though viewID and instantiationID are setup before the GO goes live, this data can't be set. as workaround: fetch it if needed
100 this.instantiationDataField = PhotonNetwork.networkingPeer.FetchInstantiationData(this.instantiationId);
101 }
102 return this.instantiationDataField;
103 }
104 set { this.instantiationDataField = value; }
105 }
File name: PhotonView.cs
Copy
243 protected internal void Awake()
244 {
245 // registration might be too late when some script (on this GO) searches this view BUT GetPhotonView() can search ALL in that case
246 PhotonNetwork.networkingPeer.RegisterPhotonView(this);
247
248 this.instantiationDataField = PhotonNetwork.networkingPeer.FetchInstantiationData(this.instantiationId);
249 this.didAwake = true;
250 }
FetchInstantiationData 108 lượt xem
Gõ tìm kiếm nhanh...