File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3- using System . Diagnostics ;
43using System . Linq ;
54#if UNITY_EDITOR
65using ToolBox . Loader . Editor ;
@@ -55,27 +54,25 @@ public static IEnumerable<T> GetAll<T>() where T : ScriptableObject, ILoadable
5554#if UNITY_EDITOR
5655 private static void LoadAssetsInEditor ( )
5756 {
58- _loadables = EditorStorage .
59- GetAllAssetsOfType < ScriptableObject > ( ) .
60- Where ( x => x is ILoadable ) .
61- Cast < ILoadable > ( ) .
62- ToArray ( ) ;
57+ _loadables = EditorStorage
58+ . GetAllAssetsOfType < ScriptableObject > ( )
59+ . OfType < ILoadable > ( )
60+ . ToArray ( ) ;
6361 }
6462
6563 internal void LoadAssets ( )
6664 {
67- // I don't know why but if you don't select this asset before building, array will be empty in build
68- Selection . activeObject = this ;
69-
7065 var assets = EditorStorage . GetAllAssetsOfType < ScriptableObject > ( ) ;
71- var loadables = assets . Where ( x => x is ILoadable ) . ToArray ( ) ;
72- var initializables = assets . Where ( x => x is IInitializableBeforeBuild ) . Cast < IInitializableBeforeBuild > ( ) ;
66+ var loadables = assets . OfType < ILoadable > ( ) . ToArray ( ) ;
67+ var initializables = assets . OfType < IInitializableBeforeBuild > ( ) ;
7368
7469 _assets = new ScriptableObject [ loadables . Length ] ;
7570 Array . Copy ( loadables , _assets , loadables . Length ) ;
7671
7772 foreach ( var initializable in initializables )
7873 initializable . Init ( ) ;
74+
75+ EditorUtility . SetDirty ( this ) ;
7976 }
8077#endif
8178 }
You can’t perform that action at this time.
0 commit comments