private static void ProjectWindowItemOnGUI(string guid, Rect rect) { if (!SingletonAssetCache.TryGetEntry(guid, out var metadata) || metadata.SingletonAssetAttribute == null) { return; } if (rect.height > EditorGUIUtility.singleLineHeight) { DrawProjectGridItem(rect, metadata); } else { DrawProjectItem(rect, AssetDatabase.GUIDToAssetPath(guid), metadata); } }
private static void OnPostHeaderGUI(Editor editor) { if (editor.targets.Length > 1 || !EditorUtility.IsPersistent(editor.target) || !SingletonAssetCache.TryGetEntry(editor.serializedObject.targetObject, out var metadata) || metadata.SingletonAssetAttribute == null) { return; } var resPath = metadata.ResourcesPath; var hasCorrectPath = metadata.IsInLoadablePath; using (new GUILayout.HorizontalScope()) { var iconContent = new GUIContent(GetGuiContent(hasCorrectPath, resPath)); iconContent.text = "Singleton Asset"; using (new EditorGUIUtility.IconSizeScope(new Vector2(17, 17))) GUILayout.Label(iconContent, GUILayout.ExpandWidth(false)); GUI.enabled = false; EditorGUILayout.TextField($"*/Resources/{resPath}"); GUI.enabled = true; } }