Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit a110177

Browse files
committed
Fixed errors with mismatched dll versions [ugly hack]
1 parent 0e583be commit a110177

4 files changed

Lines changed: 33 additions & 23 deletions

File tree

PostProcessing/Editor/EffectListEditor.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ public void Init(PostProcessProfile asset, SerializedObject serializedObject)
3838
m_Editors = new List<PostProcessEffectBaseEditor>();
3939

4040
// Gets the list of all available postfx editors
41-
var editorTypes = AppDomain.CurrentDomain.GetAssemblies()
42-
.SelectMany(
43-
a => a.GetTypes()
44-
.Where(
45-
t => t.IsSubclassOf(typeof(PostProcessEffectBaseEditor))
46-
&& t.IsDefined(typeof(PostProcessEditorAttribute), false)
47-
)
48-
).ToList();
41+
var editorTypes = RuntimeUtilities.GetAllAssemblyTypes()
42+
.Where(
43+
t => t.IsSubclassOf(typeof(PostProcessEffectBaseEditor))
44+
&& t.IsDefined(typeof(PostProcessEditorAttribute), false)
45+
&& !t.IsAbstract
46+
);
4947

5048
// Map them to their corresponding settings type
5149
foreach (var editorType in editorTypes)

PostProcessing/Editor/Utils/EditorUtilities.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ static void ReloadDecoratorTypes()
3232
s_AttributeDecorators.Clear();
3333

3434
// Look for all the valid attribute decorators
35-
var types = AppDomain.CurrentDomain.GetAssemblies()
36-
.SelectMany(
37-
a => a.GetTypes()
38-
.Where(
39-
t => t.IsSubclassOf(typeof(AttributeDecorator))
40-
&& t.IsDefined(typeof(DecoratorAttribute), false)
41-
)
42-
);
35+
var types = RuntimeUtilities.GetAllAssemblyTypes()
36+
.Where(
37+
t => t.IsSubclassOf(typeof(AttributeDecorator))
38+
&& t.IsDefined(typeof(DecoratorAttribute), false)
39+
&& !t.IsAbstract
40+
);
4341

4442
// Store them
4543
foreach (var type in types)

PostProcessing/Runtime/PostProcessManager.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,11 @@ void ReloadBaseTypes()
6868
CleanBaseTypes();
6969

7070
// Rebuild the base type map
71-
var types = AppDomain.CurrentDomain.GetAssemblies()
72-
.SelectMany(
73-
a => a.GetTypes()
74-
.Where(
75-
t => t.IsSubclassOf(typeof(PostProcessEffectSettings))
76-
&& t.IsDefined(typeof(PostProcessAttribute), false)
77-
)
71+
var types = RuntimeUtilities.GetAllAssemblyTypes()
72+
.Where(
73+
t => t.IsSubclassOf(typeof(PostProcessEffectSettings))
74+
&& t.IsDefined(typeof(PostProcessAttribute), false)
75+
&& !t.IsAbstract
7876
);
7977

8078
foreach (var type in types)

PostProcessing/Runtime/Utils/RuntimeUtilities.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,22 @@ public static Matrix4x4 GenerateJitteredProjectionMatrixFromOriginal(PostProcess
492492

493493
#region Reflection
494494

495+
public static IEnumerable<Type> GetAllAssemblyTypes()
496+
{
497+
return AppDomain.CurrentDomain.GetAssemblies()
498+
.SelectMany(t =>
499+
{
500+
// Ugly hack to handle mis-versioned dlls
501+
var innerTypes = new Type[0];
502+
try
503+
{
504+
innerTypes = t.GetTypes();
505+
}
506+
catch {}
507+
return innerTypes;
508+
});
509+
}
510+
495511
// Quick extension method to get the first attribute of type T on a given Type
496512
public static T GetAttribute<T>(this Type type) where T : Attribute
497513
{

0 commit comments

Comments
 (0)