public void OnEnable() { cullArea = (CullArea)target; // Destroying the newly created cull area if there is already one existing if (FindObjectsOfType <CullArea>().Length > 1) { Debug.LogWarning("Destroying newly created cull area because there is already one existing in the scene."); DestroyImmediate(cullArea); return; } // Prevents the dropdown from resetting if (cullArea != null) { upAxisOptions = cullArea.YIsUpAxis ? UP_AXIS_OPTIONS.SideScrollerMode : UP_AXIS_OPTIONS.TopDownOr3DMode; } }
/// <summary> /// Gets references to the PhotonView component and the cull area game object. /// </summary> private void OnEnable() { if (this.pView == null) { this.pView = GetComponent <PhotonView>(); if (!this.pView.IsMine) { return; } } if (this.cullArea == null) { this.cullArea = FindObjectOfType <CullArea>(); } this.previousActiveCells = new List <byte>(0); this.activeCells = new List <byte>(0); this.currentPosition = this.lastPosition = transform.position; }