private void UpdateBounds(Camera oldCam, Camera newCam)
        {
            if (newCam == null || !newCam.orthographic)
            {
                windowBounds.Value = Vector2.zero;
                return;
            }

            Vector2 bounds = UnityEngineUtils.WorldOrthographicSize(newCam);

            windowBounds.Value = bounds;
        }
        private bool IsOnScreen()
        {
            if (camera == null || camera.Value == null)
            {
                return(false);
            }
            Camera main = camera.Value;

            Vector2 size   = UnityEngineUtils.WorldOrthographicSize(main);
            Bounds  bounds = new Bounds((Vector2)main.transform.position + cameraOffset,
                                        size * cameraScale + cameraSizeInc);

            return(bounds.Contains((Vector2)transform.position));
        }
        public void Register(bool destroyOnRegister = false)
        {
            if (registered)
            {
                return;
            }

            toRegister = GetComponent <T>();
            Assert.IsNotNull(toRegister, "Component not present in RegisterVar " + this.name);
            Assert.IsNotNull(ArrayVar, "ArrayVar not present in RegisterVar " + this.name);
            ArrayVar.Add(toRegister);

            registered = true;

            if (UnityEngineUtils.IsInPlayModeOrAboutToPlay())
            {
                if (destroyOnRegister)
                {
                    Destroy(this);
                }
            }
        }