GetInstantiatedObjectsId
How do I use Get Instantiated Objects Id
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
2567 | public int GetInstantiatedObjectsId(GameObject go) | 1 |
File name: NetworkingPeer.cs
Copy
2567 public int GetInstantiatedObjectsId(GameObject go)
2568 {
2569 int id = -1;
2570 if (go == null)
2571 {
2572 Debug.LogError("GetInstantiatedObjectsId() for GO == null.");
2573 return id;
2574 }
2575
2576 PhotonView[] pvs = go.GetPhotonViewsInChildren();
2577 if (pvs != null && pvs.Length > 0 && pvs[0] != null)
2578 {
2579 return pvs[0].instantiationId;
2580 }
2581
2582 if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
2583 UnityEngine.Debug.Log("GetInstantiatedObjectsId failed for GO: " + go);
2584
2585
2586 return id;
2587 }
GetInstantiatedObjectsId 135 lượt xem
Gõ tìm kiếm nhanh...