ActorNr









How do I use Actor Nr
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: LoadbalancingPeer.cs Copy
282         public bool OpSetCustomPropertiesOfActor(int actorNr, Hashtable actorProperties, bool broadcast, byte channelId)
283         {
284             return this.OpSetPropertiesOfActor(actorNr, actorProperties.StripToStringKeys(), broadcast, channelId);
285         }
File name: LoadbalancingPeer.cs Copy
287         protected bool OpSetPropertiesOfActor(int actorNr, Hashtable actorProperties, bool broadcast, byte channelId)
288         {
289             if (this.DebugOut >= DebugLevel.INFO)
290             {
291                 this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor()");
292             }
293
294             if (actorNr <= 0 || actorProperties == null)
295             {
296                 if (this.DebugOut >= DebugLevel.INFO)
297                 {
298                     this.Listener.DebugReturn(DebugLevel.INFO, "OpSetPropertiesOfActor not sent. ActorNr must be > 0 and actorProperties != null.");
299                 }
300                 return false;
301             }
302
303             Dictionary opParameters = new Dictionary();
304             opParameters.Add(ParameterCode.Properties, actorProperties);
305             opParameters.Add(ParameterCode.ActorNr, actorNr);
306             if (broadcast)
307             {
308                 opParameters.Add(ParameterCode.Broadcast, broadcast);
309             }
310
311             return this.OpCustom((byte)OperationCode.SetProperties, opParameters, broadcast, channelId);
312         }
File name: NetworkingPeer.cs Copy
530     // joins a room and sets your current username as custom actorproperty (will broadcast that)
536     private void ReadoutProperties(Hashtable gameProperties, Hashtable pActorProperties, int targetActorNr)
537     {
538         // Debug.LogWarning("ReadoutProperties gameProperties: " + gameProperties.ToStringFull() + " pActorProperties: " + pActorProperties.ToStringFull() + " targetActorNr: " + targetActorNr);
539         // read game properties and cache them locally
540         if (this.mCurrentGame != null && gameProperties != null)
541         {
542             this.mCurrentGame.CacheProperties(gameProperties);
543             SendMonoMessage(PhotonNetworkingMessage.OnPhotonCustomRoomPropertiesChanged, gameProperties);
544             if (PhotonNetwork.automaticallySyncScene)
545             {
546                 this.LoadLevelIfSynced(); // will load new scene if sceneName was changed
547             }
548         }
549
550         if (pActorProperties != null && pActorProperties.Count > 0)
551         {
552             if (targetActorNr > 0)
553             {
554                 // we have a single entry in the pActorProperties with one
555                 // user's name
556                 // targets MUST exist before you set properties
557                 PhotonPlayer target = this.GetPlayerWithID(targetActorNr);
558                 if (target != null)
559                 {
560                     Hashtable props = this.GetActorPropertiesForActorNr(pActorProperties, targetActorNr);
561                     target.InternalCacheProperties(props);
562                     SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, target, props);
563                 }
564             }
565             else
566             {
567                 // in this case, we've got a key-value pair per actor (each
568                 // value is a hashtable with the actor's properties then)
569                 int actorNr;
570                 Hashtable props;
571                 string newName;
572                 PhotonPlayer target;
573
574                 foreach (object key in pActorProperties.Keys)
575                 {
576                     actorNr = (int)key;
577                     props = (Hashtable)pActorProperties[key];
578                     newName = (string)props[ActorProperties.PlayerName];
579
580                     target = this.GetPlayerWithID(actorNr);
581                     if (target == null)
582                     {
583                         target = new PhotonPlayer(false, actorNr, newName);
584                         this.AddNewPlayer(actorNr, target);
585                     }
586
587                     target.InternalCacheProperties(props);
588                     SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, target, props);
589                 }
590             }
591         }
592     }
File name: NetworkingPeer.cs Copy
780     private Hashtable GetActorPropertiesForActorNr(Hashtable actorProperties, int actorNr)
781     {
782         if (actorProperties.ContainsKey(actorNr))
783         {
784             return (Hashtable)actorProperties[actorNr];
785         }
786
787         return actorProperties;
788     }
File name: NetworkingPeer.cs Copy
822     private void GameEnteredOnGameServer(OperationResponse operationResponse)
823     {
824         if (operationResponse.ReturnCode != 0)
825         {
826             switch (operationResponse.OperationCode)
827             {
828                 case OperationCode.CreateGame:
829                     if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
830                     {
831                         Debug.Log("Create failed on GameServer. Changing back to MasterServer. Msg: " + operationResponse.DebugMessage);
832                     }
833                     SendMonoMessage(PhotonNetworkingMessage.OnPhotonCreateRoomFailed, operationResponse.ReturnCode, operationResponse.DebugMessage);
834                     break;
835                 case OperationCode.JoinGame:
836                     if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
837                     {
838                         Debug.Log("Join failed on GameServer. Changing back to MasterServer. Msg: " + operationResponse.DebugMessage);
839                         if (operationResponse.ReturnCode == ErrorCode.GameDoesNotExist)
840                         {
841                             Debug.Log("Most likely the game became empty during the switch to GameServer.");
842                         }
843                     }
844                     SendMonoMessage(PhotonNetworkingMessage.OnPhotonJoinRoomFailed, operationResponse.ReturnCode, operationResponse.DebugMessage);
845                     break;
846                 case OperationCode.JoinRandomGame:
847                     if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
848                     {
849                         Debug.Log("Join failed on GameServer. Changing back to MasterServer. Msg: " + operationResponse.DebugMessage);
850                         if (operationResponse.ReturnCode == ErrorCode.GameDoesNotExist)
851                         {
852                             Debug.Log("Most likely the game became empty during the switch to GameServer.");
853                         }
854                     }
855                     SendMonoMessage(PhotonNetworkingMessage.OnPhotonRandomJoinFailed, operationResponse.ReturnCode, operationResponse.DebugMessage);
856                     break;
857             }
858
859             this.DisconnectToReconnect();
860             return;
861         }
862
863         this.State = global::PeerState.Joined;
864         this.mRoomToGetInto.isLocalClientInside = true;
865
866         Hashtable actorProperties = (Hashtable)operationResponse[ParameterCode.PlayerProperties];
867         Hashtable gameProperties = (Hashtable)operationResponse[ParameterCode.GameProperties];
868         this.ReadoutProperties(gameProperties, actorProperties, 0);
869
870         // the local player's actor-properties are not returned in join-result. add this player to the list
871         int localActorNr = (int)operationResponse[ParameterCode.ActorNr];
872
873         this.ChangeLocalID(localActorNr);
874         this.CheckMasterClient(-1);
875
876         if (this.mPlayernameHasToBeUpdated)
877         {
878             this.SendPlayerName();
879         }
880
881         switch (operationResponse.OperationCode)
882         {
883             case OperationCode.CreateGame:
884                 SendMonoMessage(PhotonNetworkingMessage.OnCreatedRoom);
885                 break;
886             case OperationCode.JoinGame:
887             case OperationCode.JoinRandomGame:
888                 // the mono message for this is sent at another place
889                 break;
890         }
891     }
File name: NetworkingPeer.cs Copy
1631     public void OnEvent(EventData photonEvent)
1632     {
1633         if (PhotonNetwork.logLevel >= PhotonLogLevel.Informational)
1634             Debug.Log(string.Format("OnEvent: {0}", photonEvent.ToString()));
1635
1636         int actorNr = -1;
1637         PhotonPlayer originatingPlayer = null;
1638
1639         if (photonEvent.Parameters.ContainsKey(ParameterCode.ActorNr))
1640         {
1641             actorNr = (int)photonEvent[ParameterCode.ActorNr];
1642             if (this.mActors.ContainsKey(actorNr))
1643             {
1644                 originatingPlayer = (PhotonPlayer)this.mActors[actorNr];
1645             }
1646             //else
1647             //{
1648             // // the actor sending this event is not in actorlist. this is usually no problem
1649             // if (photonEvent.Code != (byte)LiteOpCode.Join)
1650             // {
1651             // Debug.LogWarning("Received event, but we do not have this actor: " + actorNr);
1652             // }
1653             //}
1654         }
1655
1656         switch (photonEvent.Code)
1657         {
1658             case PunEvent.OwnershipRequest:
1659             {
1660                 int[] requestValues = (int[]) photonEvent.Parameters[ParameterCode.CustomEventContent];
1661                 int requestedViewId = requestValues[0];
1662                 int currentOwner = requestValues[1];
1663                 Debug.Log("Ev OwnershipRequest: " + photonEvent.Parameters.ToStringFull() + " ViewID: " + requestedViewId + " from: " + currentOwner + " Time: " + Environment.TickCount%1000);
1664
1665                 PhotonView requestedView = PhotonView.Find(requestedViewId);
1666                 if (requestedView == null)
1667                 {
1668                     Debug.LogWarning("Can't find PhotonView of incoming OwnershipRequest. ViewId not found: " + requestedViewId);
1669                     break;
1670                 }
1671
1672                 Debug.Log("Ev OwnershipRequest PhotonView.ownershipTransfer: " + requestedView.ownershipTransfer + " .ownerId: " + requestedView.ownerId + " isOwnerActive: " + requestedView.isOwnerActive + ". This client's player: " + PhotonNetwork.player.ToStringFull());
1673
1674                 switch (requestedView.ownershipTransfer)
1675                 {
1676                     case OwnershipOption.Fixed:
1677                         Debug.LogWarning("Ownership mode == fixed. Ignoring request.");
1678                         break;
1679                     case OwnershipOption.Takeover:
1680                         if (currentOwner == requestedView.ownerId)
1681                         {
1682                             // a takeover is successful automatically, if taken from current owner
1683                             requestedView.ownerId = actorNr;
1684                         }
1685                         break;
1686                     case OwnershipOption.Request:
1687                         if (currentOwner == PhotonNetwork.player.ID || PhotonNetwork.player.isMasterClient)
1688                         {
1689                             if ((requestedView.ownerId == PhotonNetwork.player.ID) || (PhotonNetwork.player.isMasterClient && !requestedView.isOwnerActive))
1690                             {
1691                                 SendMonoMessage(PhotonNetworkingMessage.OnOwnershipRequest, new object[] {requestedView, originatingPlayer});
1692                             }
1693                         }
1694                         break;
1695                     default:
1696                         break;
1697                 }
1698             }
1699                 break;
1700
1701             case PunEvent.OwnershipTransfer:
1702                 {
1703                     int[] transferViewToUserID = (int[]) photonEvent.Parameters[ParameterCode.CustomEventContent];
1704                     Debug.Log("Ev OwnershipTransfer. ViewID " + transferViewToUserID[0] + " to: " + transferViewToUserID[1] + " Time: " + Environment.TickCount%1000);
1705
1706                     int requestedViewId = transferViewToUserID[0];
1707                     int newOwnerId = transferViewToUserID[1];
1708
1709                     PhotonView pv = PhotonView.Find(requestedViewId);
1710                     pv.ownerId = newOwnerId;
1711
1712                     break;
1713                 }
1714             case EventCode.GameList:
1715                 {
1716                     this.mGameList = new Dictionary();
1717                     Hashtable games = (Hashtable)photonEvent[ParameterCode.GameList];
1718                     foreach (DictionaryEntry game in games)
1719                     {
1720                         string gameName = (string)game.Key;
1721                         this.mGameList[gameName] = new RoomInfo(gameName, (Hashtable)game.Value);
1722                     }
1723                     mGameListCopy = new RoomInfo[mGameList.Count];
1724                     mGameList.Values.CopyTo(mGameListCopy, 0);
1725                     SendMonoMessage(PhotonNetworkingMessage.OnReceivedRoomListUpdate);
1726                     break;
1727                 }
1728
1729             case EventCode.GameListUpdate:
1730                 {
1731                     Hashtable games = (Hashtable)photonEvent[ParameterCode.GameList];
1732                     foreach (DictionaryEntry room in games)
1733                     {
1734                         string gameName = (string)room.Key;
1735                         RoomInfo game = new RoomInfo(gameName, (Hashtable)room.Value);
1736                         if (game.removedFromList)
1737                         {
1738                             this.mGameList.Remove(gameName);
1739                         }
1740                         else
1741                         {
1742                             this.mGameList[gameName] = game;
1743                         }
1744                     }
1745                     this.mGameListCopy = new RoomInfo[this.mGameList.Count];
1746                     this.mGameList.Values.CopyTo(this.mGameListCopy, 0);
1747                     SendMonoMessage(PhotonNetworkingMessage.OnReceivedRoomListUpdate);
1748                     break;
1749                 }
1750
1751             case EventCode.QueueState:
1752                 // not used anymore
1753                 break;
1754
1755             case EventCode.AppStats:
1756                 // Debug.LogInfo("Received stats!");
1757                 this.mPlayersInRoomsCount = (int)photonEvent[ParameterCode.PeerCount];
1758                 this.mPlayersOnMasterCount = (int)photonEvent[ParameterCode.MasterPeerCount];
1759                 this.mGameCount = (int)photonEvent[ParameterCode.GameCount];
1760                 break;
1761
1762             case EventCode.Join:
1763                 // actorNr is fetched out of event above
1764                 Hashtable actorProperties = (Hashtable)photonEvent[ParameterCode.PlayerProperties];
1765                 if (originatingPlayer == null)
1766                 {
1767                     bool isLocal = this.mLocalActor.ID == actorNr;
1768                     this.AddNewPlayer(actorNr, new PhotonPlayer(isLocal, actorNr, actorProperties));
1769                     this.ResetPhotonViewsOnSerialize(); // This sets the correct OnSerializeState for Reliable OnSerialize
1770                 }
1771
1772                 if (actorNr == this.mLocalActor.ID)
1773                 {
1774                     // in this player's 'own' join event, we get a complete list of players in the room, so check if we know all players
1775                     int[] actorsInRoom = (int[])photonEvent[ParameterCode.ActorList];
1776                     foreach (int actorNrToCheck in actorsInRoom)
1777                     {
1778                         if (this.mLocalActor.ID != actorNrToCheck && !this.mActors.ContainsKey(actorNrToCheck))
1779                         {
1780                             this.AddNewPlayer(actorNrToCheck, new PhotonPlayer(false, actorNrToCheck, string.Empty));
1781                         }
1782                     }
1783
1784                     // joinWithCreateOnDemand can turn an OpJoin into creating the room. Then actorNumber is 1 and callback: OnCreatedRoom()
1785                     if (this.mLastJoinType == JoinType.JoinOrCreateOnDemand && this.mLocalActor.ID == 1)
1786                     {
1787                         SendMonoMessage(PhotonNetworkingMessage.OnCreatedRoom);
1788                     }
1789                     SendMonoMessage(PhotonNetworkingMessage.OnJoinedRoom); //Always send OnJoinedRoom
1790
1791                 }
1792                 else
1793                 {
1794                     SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerConnected, this.mActors[actorNr]);
1795                 }
1796                 break;
1797
1798             case EventCode.Leave:
1799                 this.HandleEventLeave(actorNr);
1800                 break;
1801
1802             case EventCode.PropertiesChanged:
1803                 int targetActorNr = (int)photonEvent[ParameterCode.TargetActorNr];
1804                 Hashtable gameProperties = null;
1805                 Hashtable actorProps = null;
1806                 if (targetActorNr == 0)
1807                 {
1808                     gameProperties = (Hashtable)photonEvent[ParameterCode.Properties];
1809                 }
1810                 else
1811                 {
1812                     actorProps = (Hashtable)photonEvent[ParameterCode.Properties];
1813                 }
1814
1815                 this.ReadoutProperties(gameProperties, actorProps, targetActorNr);
1816                 break;
1817
1818             case PunEvent.RPC:
1819                 //ts: each event now contains a single RPC. execute this
1820                 // Debug.Log("Ev RPC from: " + originatingPlayer);
1821                 this.ExecuteRPC(photonEvent[ParameterCode.Data] as Hashtable, originatingPlayer);
1822                 break;
1823
1824             case PunEvent.SendSerialize:
1825             case PunEvent.SendSerializeReliable:
1826                 Hashtable serializeData = (Hashtable)photonEvent[ParameterCode.Data];
1827                 //Debug.Log(serializeData.ToStringFull());
1828
1829                 int remoteUpdateServerTimestamp = (int)serializeData[(byte)0];
1830                 short remoteLevelPrefix = -1;
1831                 short initialDataIndex = 1;
1832                 if (serializeData.ContainsKey((byte)1))
1833                 {
1834                     remoteLevelPrefix = (short)serializeData[(byte)1];
1835                     initialDataIndex = 2;
1836                 }
1837
1838                 for (short s = initialDataIndex; s < serializeData.Count; s++)
1839                 {
1840                     this.OnSerializeRead(serializeData[s] as Hashtable, originatingPlayer, remoteUpdateServerTimestamp, remoteLevelPrefix);
1841                 }
1842                 break;
1843
1844             case PunEvent.Instantiation:
1845                 this.DoInstantiate((Hashtable)photonEvent[ParameterCode.Data], originatingPlayer, null);
1846                 break;
1847
1848             case PunEvent.CloseConnection:
1849                 // MasterClient "requests" a disconnection from us
1850                 if (originatingPlayer == null || !originatingPlayer.isMasterClient)
1851                 {
1852                     Debug.LogError("Error: Someone else(" + originatingPlayer + ") then the masterserver requests a disconnect!");
1853                 }
1854                 else
1855                 {
1856                     PhotonNetwork.LeaveRoom();
1857                 }
1858
1859                 break;
1860
1861             case PunEvent.DestroyPlayer:
1862                 Hashtable evData = (Hashtable)photonEvent[ParameterCode.Data];
1863                 int targetPlayerId = (int)evData[(byte)0];
1864                 if (targetPlayerId >= 0)
1865                 {
1866                     this.DestroyPlayerObjects(targetPlayerId, true);
1867                 }
1868                 else
1869                 {
1870                     if (this.DebugOut >= DebugLevel.INFO) Debug.Log("Ev DestroyAll! By PlayerId: " + actorNr);
1871                     this.DestroyAll(true);
1872                 }
1873                 break;
1874
1875             case PunEvent.Destroy:
1876                 evData = (Hashtable)photonEvent[ParameterCode.Data];
1877                 int instantiationId = (int)evData[(byte)0];
1878                 // Debug.Log("Ev Destroy for viewId: " + instantiationId + " sent by owner: " + (instantiationId / PhotonNetwork.MAX_VIEW_IDS == actorNr) + " this client is owner: " + (instantiationId / PhotonNetwork.MAX_VIEW_IDS == this.mLocalActor.ID));
1879
1880
1881                 PhotonView pvToDestroy = null;
1882                 if (this.photonViewList.TryGetValue(instantiationId, out pvToDestroy))
1883                 {
1884                     this.RemoveInstantiatedGO(pvToDestroy.gameObject, true);
1885                 }
1886                 else
1887                 {
1888                     if (this.DebugOut >= DebugLevel.ERROR) Debug.LogError("Ev Destroy Failed. Could not find PhotonView with instantiationId " + instantiationId + ". Sent by actorNr: " + actorNr);
1889                 }
1890
1891                 break;
1892
1893             case PunEvent.AssignMaster:
1894                 evData = (Hashtable)photonEvent[ParameterCode.Data];
1895                 int newMaster = (int)evData[(byte)1];
1896                 this.SetMasterClient(newMaster, false);
1897                 break;
1898
1899             default:
1900                 if (photonEvent.Code < 200 && PhotonNetwork.OnEventCall != null)
1901                 {
1902                     object content = photonEvent[ParameterCode.Data];
1903                     PhotonNetwork.OnEventCall(photonEvent.Code, content, actorNr);
1904                 }
1905                 else
1906                 {
1907                     // actorNr might be null. it is fetched out of event on top of method
1908                     // Hashtable eventContent = (Hashtable) photonEvent[ParameterCode.Data];
1909                     // this.mListener.customEventAction(actorNr, eventCode, eventContent);
1910                     Debug.LogError("Error. Unhandled event: " + photonEvent);
1911                 }
1912                 break;
1913         }
1914
1915         this.externalListener.OnEvent(photonEvent);
1916     }
File name: NetworkingPeer.cs Copy
2430     public void DestroyPlayerObjects(int playerId, bool localOnly)
2431     {
2432         if (playerId <= 0)
2433         {
2434             Debug.LogError("Failed to Destroy objects of playerId: " + playerId);
2435             return;
2436         }
2437
2438         if (!localOnly)
2439         {
2440             // clean server's Instantiate and RPC buffers
2441             this.OpRemoveFromServerInstantiationsOfPlayer(playerId);
2442             this.OpCleanRpcBuffer(playerId);
2443
2444             // send Destroy(player) to anyone else
2445             this.SendDestroyOfPlayer(playerId);
2446         }
2447
2448         // locally cleaning up that player's objects
2449         HashSet playersGameObjects = new HashSet();
2450         foreach (PhotonView view in this.photonViewList.Values)
2451         {
2452             if (view.CreatorActorNr == playerId)
2453             {
2454                 playersGameObjects.Add(view.gameObject);
2455             }
2456         }
2457
2458         // any non-local work is already done, so with the list of that player's objects, we can clean up (locally only)
2459         foreach (GameObject gameObject in playersGameObjects)
2460         {
2461             this.RemoveInstantiatedGO(gameObject, true);
2462         }
2463
2464         // with ownership transfer, some objects might lose their owner.
2465         // in that case, the creator becomes the owner again. every client can apply this. done below.
2466         foreach (PhotonView view in this.photonViewList.Values)
2467         {
2468             if (view.ownerId == playerId)
2469             {
2470                 view.ownerId = view.CreatorActorNr;
2471                 //Debug.Log("Creator is: " + view.ownerId);
2472             }
2473         }
2474     }
File name: NetworkingPeer.cs Copy
2493     protected internal void RemoveInstantiatedGO(GameObject go, bool localOnly)
2494     {
2495         if (go == null)
2496         {
2497             Debug.LogError("Failed to 'network-remove' GameObject because it's null.");
2498             return;
2499         }
2500
2501         // Don't remove the GO if it doesn't have any PhotonView
2502         PhotonView[] views = go.GetComponentsInChildren(true);
2503         if (views == null || views.Length <= 0)
2504         {
2505             Debug.LogError("Failed to 'network-remove' GameObject because has no PhotonView components: " + go);
2506             return;
2507         }
2508
2509         PhotonView viewZero = views[0];
2510         int creatorId = viewZero.CreatorActorNr; // creatorId of obj is needed to delete EvInstantiate (only if it's from that user)
2511         int instantiationId = viewZero.instantiationId; // actual, live InstantiationIds start with 1 and go up
2512
2513         // Don't remove GOs that are owned by others (unless this is the master and the remote player left)
2514         if (!localOnly)
2515         {
2516             if (!viewZero.isMine)
2517             {
2518                 Debug.LogError("Failed to 'network-remove' GameObject. Client is neither owner nor masterClient taking over for owner who left: " + viewZero);
2519                 return;
2520             }
2521
2522             // Don't remove the Instantiation from the server, if it doesn't have a proper ID
2523             if (instantiationId < 1)
2524             {
2525                 Debug.LogError("Failed to 'network-remove' GameObject because it is missing a valid InstantiationId on view: " + viewZero + ". Not Destroying GameObject or PhotonViews!");
2526                 return;
2527             }
2528         }
2529
2530
2531         // cleanup instantiation (event and local list)
2532         if (!localOnly)
2533         {
2534             this.ServerCleanInstantiateAndDestroy(instantiationId, creatorId, viewZero.isRuntimeInstantiated); // server cleaning
2535         }
2536
2537
2538         // cleanup PhotonViews and their RPCs events (if not localOnly)
2539         for (int j = views.Length - 1; j >= 0; j--)
2540         {
2541             PhotonView view = views[j];
2542             if (view == null)
2543             {
2544                 continue;
2545             }
2546
2547             // we only destroy/clean PhotonViews that were created by PhotonNetwork.Instantiate (and those have an instantiationId!)
2548             if (view.instantiationId >= 1)
2549             {
2550                 this.LocalCleanPhotonView(view);
2551             }
2552             if (!localOnly)
2553             {
2554                 this.OpCleanRpcBuffer(view);
2555             }
2556         }
2557
2558         if (PhotonNetwork.logLevel >= PhotonLogLevel.Full)
2559             Debug.Log("Network destroy Instantiated GO: " + go.name);
2560
2561         GameObject.Destroy(go);
2562     }
File name: NetworkingPeer.cs Copy
2615     private void SendDestroyOfPlayer(int actorNr)
2616     {
2617         Hashtable evData = new Hashtable();
2618         evData[(byte)0] = actorNr;
2619
2620         this.OpRaiseEvent(PunEvent.DestroyPlayer, evData, true, null);
2621         //this.OpRaiseEvent(PunEvent.DestroyPlayer, evData, true, 0, EventCaching.DoNotCache, ReceiverGroup.Others);
2622     }
File name: NetworkingPeer.cs Copy
2634     private void OpRemoveFromServerInstantiationsOfPlayer(int actorNr)
2635     {
2636         // removes all "Instantiation" events of player actorNr. this is not an event for anyone else
2637         RaiseEventOptions options = new RaiseEventOptions() { CachingOption = EventCaching.RemoveFromRoomCache, TargetActors = new int[] { actorNr } };
2638         this.OpRaiseEvent(PunEvent.Instantiation, null, true, options);
2639         //this.OpRaiseEvent(PunEvent.Instantiation, null, true, 0, new int[] { actorNr }, EventCaching.RemoveFromRoomCache);
2640     }

ActorNr 128 lượt xem

Gõ tìm kiếm nhanh...