@@ -78,8 +78,10 @@ public AssetItemView()
7878 style =
7979 {
8080 flexShrink = 0 ,
81- width = 24 ,
82- height = 24 ,
81+ alignSelf = Align . Center ,
82+ width = 16 ,
83+ height = 16 ,
84+ marginLeft = 4 ,
8385 }
8486 } ;
8587 _container . Add ( _assetIcon ) ;
@@ -125,7 +127,7 @@ public void Bind(AssetHandle target)
125127 case AssetCategory . ExternalFile :
126128 string path = AssetHandle . GetAssetPath ( ) ;
127129 assetIconTex = File . Exists ( path ) || Directory . Exists ( path )
128- ? GetExternalFileTexture ( false )
130+ ? GetExternalFileTexture ( )
129131 : GetWarningTexture ( ) ;
130132 break ;
131133
@@ -301,15 +303,7 @@ private void ShowMenuItemContextMenu(Vector2 mousePosition)
301303 }
302304
303305
304- #region Static Textures
305-
306- private static Texture _sceneObjectTextureCache ;
307- private static Texture _sceneObjectTextureSmallCache ;
308- private static Texture _externalFileTextureCache ;
309- private static Texture _externalFileTextureSmallCache ;
310- private static Texture _urlTextureCache ;
311- private static Texture _menuItemTextureCache ;
312- private static Texture _warningTextureCache ;
306+ #region Get Textures
313307
314308 private static Texture GetObjectIcon ( UObject obj , SceneAsset containingScene )
315309 {
@@ -330,86 +324,35 @@ private static Texture GetObjectIcon(UObject obj, SceneAsset containingScene)
330324 }
331325 }
332326
333- return GetSceneObjectTexture ( false ) ;
327+ return GetSceneObjectTexture ( ) ;
334328 }
335329
336330 return GetWarningTexture ( ) ;
337331 }
338332
339- private static Texture GetSceneObjectTexture ( bool small )
333+ private static Texture GetSceneObjectTexture ( )
340334 {
341- if ( small )
342- {
343- if ( ! _sceneObjectTextureSmallCache )
344- {
345- _sceneObjectTextureSmallCache = ( Texture ) EditorGUIUtility . Load (
346- EditorGUIUtility . isProSkin
347- ? "d_UnityEditor.SceneHierarchyWindow"
348- : "UnityEditor.SceneHierarchyWindow" ) ;
349- }
350-
351- return _sceneObjectTextureSmallCache ;
352- }
353-
354- if ( ! _sceneObjectTextureCache )
355- {
356- _sceneObjectTextureCache = ( Texture ) EditorGUIUtility . Load (
357- EditorGUIUtility . isProSkin
358- ? "d_UnityEditor.SceneHierarchyWindow@2x"
359- : "UnityEditor.SceneHierarchyWindow@2x" ) ;
360- }
361-
362- return _sceneObjectTextureCache ;
335+ return EditorGUIUtility . IconContent ( "UnityEditor.SceneHierarchyWindow" ) . image ;
363336 }
364337
365- private static Texture GetExternalFileTexture ( bool small )
338+ private static Texture GetExternalFileTexture ( )
366339 {
367- if ( small )
368- {
369- if ( ! _externalFileTextureSmallCache )
370- {
371- _externalFileTextureSmallCache = ( Texture ) EditorGUIUtility . Load ( EditorGUIUtility . isProSkin ? "d_Import" : "Import" ) ;
372- }
373-
374- return _externalFileTextureSmallCache ;
375- }
376-
377- if ( ! _externalFileTextureCache )
378- {
379- _externalFileTextureCache = ( Texture ) EditorGUIUtility . Load ( EditorGUIUtility . isProSkin ? "d_Import@2x" : "Import@2x" ) ;
380- }
381-
382- return _externalFileTextureCache ;
340+ return EditorGUIUtility . IconContent ( "Import" ) . image ;
383341 }
384342
385343 private static Texture GetUrlTexture ( )
386344 {
387- if ( ! _urlTextureCache )
388- {
389- _urlTextureCache = ( Texture ) EditorGUIUtility . Load ( EditorGUIUtility . isProSkin ? "d_BuildSettings.Web.Small" : "BuildSettings.Web.Small" ) ;
390- }
391-
392- return _urlTextureCache ;
345+ return EditorGUIUtility . IconContent ( "BuildSettings.Web.Small" ) . image ;
393346 }
394347
395348 private static Texture GetMenuItemTexture ( )
396349 {
397- if ( ! _menuItemTextureCache )
398- {
399- _menuItemTextureCache = ( Texture ) EditorGUIUtility . Load ( EditorGUIUtility . isProSkin ? "d_PlayButton@2x" : "PlayButton@2x" ) ;
400- }
401-
402- return _menuItemTextureCache ;
350+ return EditorGUIUtility . IconContent ( "PlayButton" ) . image ;
403351 }
404352
405353 private static Texture GetWarningTexture ( )
406354 {
407- if ( ! _warningTextureCache )
408- {
409- _warningTextureCache = ( Texture ) EditorGUIUtility . Load ( "Warning@2x" ) ;
410- }
411-
412- return _warningTextureCache ;
355+ return EditorGUIUtility . IconContent ( "Warning" ) . image ;
413356 }
414357
415358 #endregion
0 commit comments