Ejemplo n.º 1
0
        /// <summary>Called by Unity on start of the application and does a setup the PhotonView.</summary>
        protected internal void Awake()
        {
            if (this.ViewID != 0)
            {
                this.ownerId = this.ViewID / PhotonNetwork.MAX_VIEW_IDS;

                // registration might be too late when some script (on this GO) searches this view BUT GetPhotonView() can search ALL in that case
                PhotonNetwork.RegisterPhotonView(this);
            }

            this.didAwake = true;
        }
Ejemplo n.º 2
0
        /// <summary>Called by Unity on start of the application and does a setup the PhotonView.</summary>
        protected internal void Awake()
        {
            if (this.ViewID != 0)
            {
                int ownerId = this.ViewID / PhotonNetwork.MAX_VIEW_IDS;
                var room    = PhotonNetwork.CurrentRoom;
                if (room != null)
                {
                    var owner = PhotonNetwork.CurrentRoom.GetPlayer(ownerId);
                    SetOwnerInternal(owner, ownerId);
                }

                // registration might be too late when some script (on this GO) searches this view BUT GetPhotonView() can search ALL in that case
                PhotonNetwork.RegisterPhotonView(this);
            }

            this.didAwake = true;
        }