From 544997918a82a678d3bb7367b235d191c2b76c53 Mon Sep 17 00:00:00 2001 From: Carnagion Date: Sun, 14 Aug 2022 18:41:07 +0200 Subject: [PATCH] Include static methods when searching for mod startup methods --- Modding/ModLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modding/ModLoader.cs b/Modding/ModLoader.cs index f2a2c18..9ffe957 100644 --- a/Modding/ModLoader.cs +++ b/Modding/ModLoader.cs @@ -112,7 +112,7 @@ private static void StartupMod(Mod mod) // Invoke all static methods annotated with [Startup] along with the supplied parameters (if any) mod.Assemblies .SelectMany(assembly => assembly.GetTypes()) - .SelectMany(type => type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public)) + .SelectMany(type => type.GetMethods(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public)) .Select(method => (method, method.GetCustomAttribute())) .Where(pair => pair.Item2 is not null) .ForEach(pair => pair.Item1.Invoke(null, pair.Item2.Parameters));