Пример #1
0
        public override void OnValidateEditor()
        {
            base.OnValidateEditor();

            WindowSystem.ApplyToSettings(this.canvas);

            if (ME.EditorUtilities.IsPrefab(this.gameObject) == true)
            {
                this.transform.localScale = Vector3.one * this.editorScale;
            }

            if (this.canvasUpdater == null || this.GetComponents <CanvasUpdater>().Length > 1)
            {
                if (this.GetComponent <CanvasUpdater>() != null)
                {
                    Component.DestroyImmediate(this.GetComponent <CanvasUpdater>());
                }
                this.canvasUpdater = this.GetComponent <CanvasUpdater>();
                if (this.canvasUpdater == null)
                {
                    this.canvasUpdater = this.gameObject.AddComponent <CanvasUpdater>();
                }
                if (this.canvasUpdater != null)
                {
                    this.canvasUpdater.OnValidate();
                }
            }

            if (this.canvasScaler == null || this.GetComponents <CanvasScaler>().Length > 1)
            {
                if (this.GetComponent <CanvasScaler>() != null)
                {
                    Component.DestroyImmediate(this.GetComponent <CanvasScaler>());
                }
                this.canvasScaler = this.GetComponent <CanvasScaler>();
                if (this.canvasScaler == null)
                {
                    this.canvasScaler = this.gameObject.AddComponent <CanvasScaler>();
                }
            }

            /*var rectTransform = (this.transform as RectTransform);
             * rectTransform.anchorMin = Vector2.zero;
             * rectTransform.anchorMax = Vector2.one;
             * rectTransform.pivot = Vector2.one * 0.5f;
             * rectTransform.localScale = Vector3.one;
             * rectTransform.localRotation = Quaternion.identity;
             * rectTransform.anchoredPosition3D = Vector3.zero;*/
        }
Пример #2
0
        private void SetupCamera()
        {
            this.workCamera = this.GetComponent <Camera>();
            if (this.workCamera == null)
            {
                this.workCamera = this.gameObject.AddComponent <Camera>();
            }

            if (this.workCamera != null)
            {
                // Camera
                WindowSystem.ApplyToSettings(this.workCamera);

                this.workCamera.cullingMask  = 0x0;
                this.workCamera.cullingMask |= 1 << this.gameObject.layer;

                this.workCamera.backgroundColor = new Color(0f, 0f, 0f, 0f);
            }

            this.initialized = (this.workCamera != null);
        }
Пример #3
0
        private void SetupCamera()
        {
            this.workCamera = ME.Utilities.FindReferenceChildren <Camera>(this);
            if (this.workCamera == null)
            {
                this.workCamera = this.gameObject.AddComponent <Camera>();
            }

            if (this.workCamera != null)
            {
                // Camera
                WindowSystem.ApplyToSettings(this.workCamera);

                if ((this.workCamera.cullingMask & (1 << this.gameObject.layer)) == 0)
                {
                    this.workCamera.cullingMask  = 0x0;
                    this.workCamera.cullingMask |= 1 << this.gameObject.layer;
                }

                this.workCamera.backgroundColor = new Color(0f, 0f, 0f, 0f);
            }

            this.isReady = (this.workCamera != null);
        }