private void OnEnable() { if (target == null) { return; } settings = target as FolderIconSettings; serializedIcons = serializedObject.FindProperty("icons"); showCustomFolders = settings.showCustomFolder; showCustomOverlay = settings.showOverlay; if (iconList == null) { iconList = new ReorderableList(serializedObject, serializedIcons) { drawHeaderCallback = OnHeaderDraw, drawElementCallback = OnElementDraw, drawElementBackgroundCallback = DrawElementBackground, elementHeightCallback = GetPropertyHeight, showDefaultBackground = false, }; } savePath = Application.dataPath; if (selectedTexture != null) { UpdatePreview(); } }
private static void ReplaceFolders(string guid, Rect selectionRect) { // Does the folder asset exist at all? if (allFolderIcons == null) { allFolderIcons = GetAllInstances <FolderIconSettings> (); } if (folderIcons == null) { if (allFolderIcons.Length > 0) { folderIcons = allFolderIcons[0] as FolderIconSettings; } } if (folderIcons == null) { return; } if (!folderIcons.showCustomFolder && !folderIcons.showOverlay) { return; } string path = AssetDatabase.GUIDToAssetPath(guid); Object folderAsset = AssetDatabase.LoadAssetAtPath(path, typeof(DefaultAsset)); if (folderAsset == null) { return; } for (int i = 0; i < folderIcons.icons.Length; i++) { var icon = folderIcons.icons[i]; if (icon.folder != folderAsset) { continue; } DrawTextures(selectionRect, icon, folderAsset, guid); } }