Esempio n. 1
0
        //----------------------------------------------------------------------

        private void ShowObjectSelector(
            int controlID,
            SerializedProperty property)
        {
            var target            = property.objectReferenceValue;
            var objectType        = fieldInfo.FieldType;
            var allowSceneObjects = AllowSceneObjects(property);

            ObjectSelector.Show(
                controlID,
                target,
                objectType,
                property,
                allowSceneObjects);
        }
Esempio n. 2
0
        //----------------------------------------------------------------------

        private void DoContextMenuGUI(
            Rect position,
            SerializedProperty property)
        {
            if (attribute.canCreateSubasset == false)
            {
                return;
            }

            var controlID = GetControlID(position);

            ObjectSelector.DoGUI(controlID, property, SetObjectReferenceValue);

            var buttonRect = position;

            buttonRect.xMin = buttonRect.xMax - 16;
            var buttonStyle = EditorStyles.label;

            var isRepaint = Event.current.type == EventType.Repaint;

            if (isRepaint)
            {
                var dropDownStyle = gui.inDropDownStyle;
                var rect          = buttonRect;
                rect.x += 2;
                rect.y += 6;
                dropDownStyle.Draw(rect, false, false, false, false);
            }

            var noLabel = GUIContent.none;

            if (GUI.Button(buttonRect, noLabel, buttonStyle))
            {
                var types = GetConcreteTypes(fieldInfo.FieldType);
                ShowContextMenu(
                    buttonRect,
                    controlID,
                    property,
                    types);
            }
        }