Esempio n. 1
0
        protected void _ColorField(ref Rect rect, UnityObject obj, Color color, Action <Color> changed)
        {
            rect.width = 32;
            ScopeChange.Begin();
            var _color = UnityEditorEditorGUI.DoColorField(rect, obj.GetInstanceID(), color, true, true, false);

            if (ScopeChange.End())
            {
                EditorHelper.Dirty(obj, () => {
                    changed(_color);
                });
            }
            rect.x += rect.width + 4;
        }
Esempio n. 2
0
        protected void _ObjectField <T>(ref Rect rect, T obj, Action <T> changed) where T : UnityObject
        {
            if (objectField == null)
            {
                objectField              = new GUIStyle(EditorStyles.objectField);
                objectField.padding.top  = 1;
                objectField.padding.left = 2;
            }
            rect.width = 33;
            ScopeChange.Begin();
            var id = go.GetInstanceID();
            var t  = obj != null?obj.GetType() : typeof(T);

            var _obj = UnityEditorEditorGUI.DoObjectField(rect, rect, id, obj, t, null, null, false, objectField);

            if (ScopeChange.End())
            {
                EditorHelper.Dirty(go, () => {
                    changed((T)_obj);
                });
            }
            rect.x += rect.width + 4;
        }