// Token: 0x060058FB RID: 22779 RVA: 0x001ED600 File Offset: 0x001EBA00 public void ReapOneObject(ObjectInstantiatorHandle obj) { if (obj == null || obj.LocalID == null) { return; } VRC.Network.RPC(VRC_EventHandler.VrcTargetType.All, base.gameObject, "_DestroyObject", new object[] { obj.LocalID.Value }); }
private void _InstantiateObject(string prefabName, byte[] data, int localID, VRC.Player instantiator) { int num = 0; float x; Protocol.Deserialize(out x, data, ref num); float y; Protocol.Deserialize(out y, data, ref num); float z; Protocol.Deserialize(out z, data, ref num); Vector3 pos = new Vector3(x, y, z); Protocol.Deserialize(out x, data, ref num); Protocol.Deserialize(out y, data, ref num); Protocol.Deserialize(out z, data, ref num); float w; Protocol.Deserialize(out w, data, ref num); Quaternion rot = new Quaternion(x, y, z, w); short num2; Protocol.Deserialize(out num2, data, ref num); int[] array = new int[(int)num2]; for (short num3 = 0; num3 < num2; num3 += 1) { int num4; Protocol.Deserialize(out num4, data, ref num); array[(int)num3] = num4; } ObjectInstantiator.PrefabInfo prefabInfo = this._FetchPrefab(prefabName); if (prefabInfo == null) { Debug.LogError("Could not instantiate " + prefabName + ": Could not find prefab", base.gameObject); VRC.Network.UnAllocateSubIDs(array); return; } GameObject gameObject = AssetManagement.Instantiate <GameObject>(prefabInfo.obj, pos, rot); if (gameObject == null) { Debug.LogError("Could not instantiate " + prefabName + ": Could not instantiate prefab", base.gameObject); VRC.Network.UnAllocateSubIDs(array); return; } gameObject.SetActive(true); ObjectInstantiatorHandle orAddComponent = gameObject.GetOrAddComponent <ObjectInstantiatorHandle>(); orAddComponent.Instantiator = this; orAddComponent.LocalID = new int?(localID); PhotonView orAddComponent2 = gameObject.GetOrAddComponent <PhotonView>(); orAddComponent2.synchronization = ViewSynchronization.Off; orAddComponent2.ownershipTransfer = OwnershipOption.Takeover; if (!VRC.Network.AssignSubIDs(gameObject, array, true)) { Debug.LogError("Could not instantiate " + prefabName + ": Could not assign IDs", base.gameObject); UnityEngine.Object.Destroy(gameObject); return; } gameObject.name = string.Concat(new object[] { prefabInfo.name, " (Dynamic Clone ", localID, ":", orAddComponent2.viewID, ")" }); Debug.LogFormat("Instantiated a {0} with Local ID {1} and View ID {2}", new object[] { prefabInfo.name, localID, orAddComponent2.viewID }); if (!this.spawnedObjects.ContainsKey(localID)) { this.spawnedObjects.Add(localID, new ObjectInstantiator.ObjectInfo { data = data, gameObject = null, prefabName = prefabName }); } VRC.Network.ProtectFromCleanup(gameObject, true); this.spawnedObjects[localID].objectPath = VRC.Network.GetGameObjectPath(gameObject); this.spawnedObjects[localID].gameObject = gameObject; VRC.Network.SetOwner(instantiator, gameObject, VRC.Network.OwnershipModificationType.Request, true); }