Browse Source

Recreate PluginContext on destroy (in case the entire scene is wiped by the game)

tags/3.1a
Eusth 7 years ago
parent
commit
5e91d68167
3 changed files with 8 additions and 3 deletions
  1. +1
    -2
      IllusionInjector/Injector.cs
  2. +7
    -0
      IllusionInjector/PluginComponent.cs
  3. +0
    -1
      IllusionInjector/PluginManager.cs

+ 1
- 2
IllusionInjector/Injector.cs View File

@@ -19,8 +19,7 @@ namespace IllusionInjector

private static void Bootstrapper_Destroyed()
{
var singleton = new GameObject("PluginManager");
singleton.AddComponent<PluginComponent>(); ;
PluginComponent.Create();
}
}
}

+ 7
- 0
IllusionInjector/PluginComponent.cs View File

@@ -10,6 +10,11 @@ namespace IllusionInjector
private CompositePlugin plugins;
private bool freshlyLoaded = false;

public static PluginComponent Create()
{
return new GameObject("IPA_PluginManager").AddComponent<PluginComponent>();
}

void Awake()
{
DontDestroyOnLoad(gameObject);
@@ -46,6 +51,8 @@ namespace IllusionInjector
void OnDestroy()
{
plugins.OnApplicationQuit();

Create();
}

void OnLevelWasLoaded(int level)


+ 0
- 1
IllusionInjector/PluginManager.cs View File

@@ -60,7 +60,6 @@ namespace IllusionInjector
Console.WriteLine(" {0}: {1}", plugin.Name, plugin.Version);
}
Console.WriteLine("-----------------------------");
}

private static IEnumerable<IPlugin> LoadPluginsFromFile(string file, string exeName)


Loading…
Cancel
Save