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 1
1
using System ;
2
2
using System . Collections . Generic ;
3
- using System . Diagnostics ;
4
3
using System . Linq ;
5
4
#if UNITY_EDITOR
6
5
using ToolBox . Loader . Editor ;
@@ -55,27 +54,25 @@ public static IEnumerable<T> GetAll<T>() where T : ScriptableObject, ILoadable
55
54
#if UNITY_EDITOR
56
55
private static void LoadAssetsInEditor ( )
57
56
{
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 ( ) ;
63
61
}
64
62
65
63
internal void LoadAssets ( )
66
64
{
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
-
70
65
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 > ( ) ;
73
68
74
69
_assets = new ScriptableObject [ loadables . Length ] ;
75
70
Array . Copy ( loadables , _assets , loadables . Length ) ;
76
71
77
72
foreach ( var initializable in initializables )
78
73
initializable . Init ( ) ;
74
+
75
+ EditorUtility . SetDirty ( this ) ;
79
76
}
80
77
#endif
81
78
}
You can’t perform that action at this time.
0 commit comments