Example #1
0
        private void OnEnable()
        {
            Cacher = ScriptableObjectExtension.ReadAsset <BGMListCacher>(CachePath);
            if (!Cacher)
            {
                ScriptableObjectExtension.WriteAsset(Cacher, CachePath);
            }


            so          = new SerializedObject(Cacher);
            BGMListView = new ReorderableList(so, so.FindProperty("BGM"));


            Instance = this;


            BGMListView.drawElementCallback =
                (Rect rect, int index, bool isActive, bool isFocused) =>
            {
                var element = BGMListView.serializedProperty.GetArrayElementAtIndex(index);
                rect.y += 2;

                EditorGUI.PropertyField(
                    new Rect(rect.x, rect.y, position.width / 2f, EditorGUIUtility.singleLineHeight),
                    element.FindPropertyRelative("Audio"), GUIContent.none);
                EditorGUI.PropertyField(
                    new Rect(rect.x + position.width / 2f, rect.y, position.width / 3f, EditorGUIUtility.singleLineHeight),
                    element.FindPropertyRelative("Tag"), GUIContent.none);
            };

            BGMListView.onChangedCallback = (list) =>
            {
            };
        }
        static void Init()
        {
            PrefabCacherWindow window = (PrefabCacherWindow)EditorWindow.GetWindow(typeof(PrefabCacherWindow));

            window.Show();

            window.titleContent = new GUIContent("Prefeb Cacher");

            gmp = ScriptableObjectExtension.ReadAsset <PrefabCacher>(AssetSave);
        }