@@ -920,6 +920,16 @@ public FileMetadata MostRecentVersion {
920
920
}
921
921
}
922
922
923
+ /// <summary>
924
+ /// Backing store for EnabledEditorDlls.
925
+ /// </summary>
926
+ private HashSet < string > enabledEditorDlls = new HashSet < string > ( ) ;
927
+
928
+ /// <summary>
929
+ /// Full path of DLLs that should be loaded into the editor application domain.
930
+ /// </summary>
931
+ public ICollection < string > EnabledEditorDlls { get { return enabledEditorDlls ; } }
932
+
923
933
/// <summary>
924
934
/// Determine whether the PluginImporter class is available in
925
935
/// UnityEditor. Unity 4 does not have the PluginImporter class so
@@ -975,6 +985,7 @@ public bool EnableMostRecentPlugins(HashSet<string> disableFiles) {
975
985
int numberOfVersions = metadataByVersion . Count ;
976
986
var disabledVersions = new List < string > ( ) ;
977
987
string enabledVersion = null ;
988
+ enabledEditorDlls = new HashSet < string > ( ) ;
978
989
979
990
// If the canonical file is out of date, update it.
980
991
if ( numberOfVersions > 0 ) {
@@ -1071,6 +1082,9 @@ public bool EnableMostRecentPlugins(HashSet<string> disableFiles) {
1071
1082
dotNetVersionMessage ) ,
1072
1083
verbose : true ) ;
1073
1084
pluginImporter . SetCompatibleWithEditor ( editorEnabled ) ;
1085
+ if ( metadata . filename . ToLower ( ) . EndsWith ( ".dll" ) ) {
1086
+ enabledEditorDlls . Add ( Path . GetFullPath ( metadata . filename ) ) ;
1087
+ }
1074
1088
modifiedThisVersion = true ;
1075
1089
}
1076
1090
bool compatibleWithAnyPlatform = pluginImporter . GetCompatibleWithAnyPlatform ( ) ;
@@ -1200,6 +1214,16 @@ public Dictionary<string, FileMetadata> MetadataByFilename {
1200
1214
get { return metadataByFilename ; }
1201
1215
}
1202
1216
1217
+ /// <summary>
1218
+ /// Backing store for EnabledEditorDlls.
1219
+ /// </summary>
1220
+ private HashSet < string > enabledEditorDlls = new HashSet < string > ( ) ;
1221
+
1222
+ /// <summary>
1223
+ /// Full path of DLLs that should be loaded into the editor application domain.
1224
+ /// </summary>
1225
+ public ICollection < string > EnabledEditorDlls { get { return enabledEditorDlls ; } }
1226
+
1203
1227
/// <summary>
1204
1228
/// Construct an instance.
1205
1229
/// </summary>
@@ -1226,6 +1250,7 @@ public static FileMetadataSet FilterOutReadOnlyFiles(FileMetadataSet metadataSet
1226
1250
public void Clear ( ) {
1227
1251
metadataByCanonicalFilename = new Dictionary < string , FileMetadataByVersion > ( ) ;
1228
1252
metadataByFilename = new Dictionary < string , FileMetadata > ( ) ;
1253
+ enabledEditorDlls = new HashSet < string > ( ) ;
1229
1254
}
1230
1255
1231
1256
/// <summary>
@@ -1545,6 +1570,7 @@ public bool EnableMostRecentPlugins(bool forceUpdate,
1545
1570
1546
1571
foreach ( var metadataByVersion in Values ) {
1547
1572
modified |= metadataByVersion . EnableMostRecentPlugins ( disableFiles ) ;
1573
+ enabledEditorDlls . UnionWith ( metadataByVersion . EnabledEditorDlls ) ;
1548
1574
}
1549
1575
return modified ;
1550
1576
}
@@ -2162,6 +2188,23 @@ private static bool Refreshing {
2162
2188
}
2163
2189
}
2164
2190
2191
+ /// <summary>
2192
+ /// Whether all editor DLLs have been loaded into the app domain.
2193
+ /// </summary>
2194
+ private static bool EnabledEditorDllsLoaded {
2195
+ get {
2196
+ var loadedAssemblyPaths = new HashSet < string > ( ) ;
2197
+ foreach ( var assembly in AppDomain . CurrentDomain . GetAssemblies ( ) ) {
2198
+ try {
2199
+ loadedAssemblyPaths . Add ( Path . GetFullPath ( assembly . Location ) ) ;
2200
+ } catch ( NotSupportedException ) {
2201
+ // Dynamic assemblies do not have a file location so ignore.
2202
+ }
2203
+ }
2204
+ return loadedAssemblyPaths . IsSupersetOf ( enabledEditorDlls ) ;
2205
+ }
2206
+ }
2207
+
2165
2208
/// <summary>
2166
2209
/// Polls on main thread until compilation is finished prior to calling
2167
2210
/// NotifyUpdateCompleteMethods() if an asset database refresh was in progress or
@@ -2183,15 +2226,15 @@ private static bool Refreshing {
2183
2226
/// refreshing.</param>
2184
2227
private static void NotifyWhenCompliationComplete ( bool forceNotification ) {
2185
2228
RunOnMainThread . PollOnUpdateUntilComplete ( ( ) => {
2186
- if ( EditorApplication . isCompiling ) {
2229
+ if ( EditorApplication . isCompiling || ! EnabledEditorDllsLoaded ) {
2187
2230
if ( ! compiling ) {
2188
2231
Log ( "Compiling..." , verbose : true ) ;
2189
2232
}
2190
2233
compiling = true ;
2191
- // In batch mode this can get stuck forever as PollOnUpdateUntilComplete()
2192
- // will block the main thread which prevents the EditorApplication.isCompiling
2193
- // flag from being updated by the editor.
2194
- return ExecutionEnvironment . InBatchMode ;
2234
+ // When running a single method this can get stuck forever as
2235
+ // PollOnUpdateUntilComplete() will block the main thread which prevents the
2236
+ // EditorApplication.isCompiling flag from being updated by the editor.
2237
+ return ExecutionEnvironment . ExecuteMethodEnabled ;
2195
2238
}
2196
2239
if ( compiling ) {
2197
2240
Log ( "Compilation complete." , verbose : true ) ;
@@ -2391,9 +2434,7 @@ public static void ShowSettings() {
2391
2434
[ MenuItem ( "Assets/External Dependency Manager/Version Handler/Update" ) ]
2392
2435
public static void UpdateNow ( ) {
2393
2436
UpdateVersionedAssets ( true , ( ) => {
2394
- if ( ! ExecutionEnvironment . InBatchMode ) {
2395
- Dialog . Display ( PLUGIN_NAME , "Update complete." , 0 , "OK" ) ;
2396
- }
2437
+ Dialog . Display ( PLUGIN_NAME , "Update complete." , 0 , "OK" ) ;
2397
2438
} ) ;
2398
2439
}
2399
2440
@@ -2535,6 +2576,10 @@ public static void UpdateVersionedAssets(bool forceUpdate) {
2535
2576
UpdateVersionedAssets ( forceUpdate , ( ) => { } ) ;
2536
2577
}
2537
2578
2579
+ /// <summary>
2580
+ /// All editor DLLs enabled by the last pass of UpdateVersionedAssets().
2581
+ /// </summary>
2582
+ private static HashSet < string > enabledEditorDlls = new HashSet < string > ( ) ;
2538
2583
2539
2584
/// <summary>
2540
2585
/// Find all files in the asset database with multiple version numbers
@@ -2565,6 +2610,7 @@ public static void UpdateVersionedAssets(bool forceUpdate, Action complete) {
2565
2610
var obsoleteFiles = new ObsoleteFiles (
2566
2611
ManifestReferences . FindAndReadManifests ( allMetadataSet ) , allMetadataSet ) ;
2567
2612
if ( metadataSet . EnableMostRecentPlugins ( forceUpdate , obsoleteFiles . All ) ) {
2613
+ enabledEditorDlls . UnionWith ( metadataSet . EnabledEditorDlls ) ;
2568
2614
analytics . Report ( "enablemostrecentplugins" , "Enable Most Recent Plugins" ) ;
2569
2615
AssetDatabase . Refresh ( ) ;
2570
2616
Refreshing = true ;
0 commit comments