Add temporary instance property to Unity and .NET chainloaders

This commit is contained in:
ghorsington committed 2022-06-05 19:02:25 +03:00
1 parent 5f13a91292
commit 9cc85135dd
2 files changed
+15 -1

No files matched your search

+10 -1
View File
@@ -7,11 +7,20 @@ namespace BepInEx.NetLauncher.Common
{
public class NetChainloader : BaseChainloader<BasePlugin>
{
// TODO: Remove once proper instance handling exists
public static NetChainloader Instance { get; set; }
public override void Initialize(string gameExePath = null)
{
Instance = this;
base.Initialize(gameExePath);
}
public override BasePlugin LoadPlugin(PluginInfo pluginInfo, Assembly pluginAssembly)
{
var type = pluginAssembly.GetType(pluginInfo.TypeName);
var pluginInstance = (BasePlugin)Activator.CreateInstance(type);
var pluginInstance = (BasePlugin) Activator.CreateInstance(type);
pluginInstance.Load();
@@ -30,6 +30,9 @@ public class UnityChainloader : BaseChainloader<BaseUnityPlugin>
private string _consoleTitle;
// TODO: Remove once proper instance handling exists
public static UnityChainloader Instance { get; set; }
/// <summary>
/// The GameObject that all plugins are attached to as components.
/// </summary>
@@ -60,6 +63,8 @@ public class UnityChainloader : BaseChainloader<BaseUnityPlugin>
public override void Initialize(string gameExePath = null)
{
Instance = this;
UnityTomlTypeConverters.AddUnityEngineConverters();
ThreadingHelper.Initialize();