예제 #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var resourcePathAsPopupAttribute = (ResourcePathAsPopupAttribute)attribute;
            var resourceType = resourcePathAsPopupAttribute.resourceType;

            ResourcePathWatcher.Update(resourceType);

            if (property.propertyType == SerializedPropertyType.String)
            {
                var index         = ResourcePathWatcher.PathIndexOf(resourceType, property.stringValue);
                var selectedIndex = EditorGUI.Popup(
                    position, label.text, index, ResourcePathWatcher.GetPathList(resourceType));
                if (index != selectedIndex)
                {
                    property.stringValue = ResourcePathWatcher.GetPath(resourceType, selectedIndex);
                }
            }
        }
예제 #2
0
        void DrawExtraInspector()
        {
            var syncObj = target as SynchronizedObject;

            SynchronizerEditorUtility.ReadOnlyTextField("Sync ID", syncObj.id);
            if (syncObj.isOverridePrefab)
            {
                ResourcePathWatcher.Update("prefab");
                var index = ResourcePathWatcher.PathIndexOf("prefab", syncObj.prefabPath);

                var selectedIndex = EditorGUILayout.Popup("Prefab Path", index, ResourcePathWatcher.GetPathList("prefab"));
                if (index != selectedIndex)
                {
                    syncObj.prefabPath = ResourcePathWatcher.GetPath("prefab", selectedIndex);
                }
            }
            else
            {
                SynchronizerEditorUtility.ReadOnlyTextField("Prefab Path", syncObj.prefabPath);
            }
        }