コード例 #1
0
        /// <summary>
        /// On type changed
        /// </summary>
        void onTypeChanged()
        {
        #if UNITY_EDITOR
            Color = BuiltInColors.Get(VariableType);
            float r = Color.r * .5f;
            float g = Color.g * .5f;
            float b = Color.b * .5f;

            _emptyColor = new Color(r, g, b);
            _labelStyle = null;

            if (IsDynamicType && OnTypeChanged != null)
            {
                OnTypeChanged(this);
            }
        #endif
        }
コード例 #2
0
        protected override void InitGUIStyles()
        {
            buttonStyle          = new GUIStyle(GUI.skin.button);
            buttonStyle.fontSize = 9;
            buttonStyle.margin   = new RectOffset(0, 0, 0, 0);
            buttonStyle.padding  = new RectOffset(0, 0, 0, 0);

            foreach (var t in _availableTypes)
            {
                var color = BuiltInColors.Get(t);
                var tex   = VisualEditorGUIStyle.GetTexture(color, color, true, true, true, true);

                GUIStyle s = new GUIStyle(GUI.skin.box);
                s.normal.background = tex.Texture;
                s.border            = tex.BorderOffset;
                styles.Add(t, s);
            }
            base.InitGUIStyles();
        }