Recreate PluginContext on destroy (in case the entire scene is wiped by the game)
This commit is contained in:
parent
a0e2310b8a
commit
5e91d68167
3 changed files with 8 additions and 3 deletions
|
@ -19,8 +19,7 @@ namespace IllusionInjector
|
||||||
|
|
||||||
private static void Bootstrapper_Destroyed()
|
private static void Bootstrapper_Destroyed()
|
||||||
{
|
{
|
||||||
var singleton = new GameObject("PluginManager");
|
PluginComponent.Create();
|
||||||
singleton.AddComponent<PluginComponent>(); ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,11 @@ namespace IllusionInjector
|
||||||
private CompositePlugin plugins;
|
private CompositePlugin plugins;
|
||||||
private bool freshlyLoaded = false;
|
private bool freshlyLoaded = false;
|
||||||
|
|
||||||
|
public static PluginComponent Create()
|
||||||
|
{
|
||||||
|
return new GameObject("IPA_PluginManager").AddComponent<PluginComponent>();
|
||||||
|
}
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
DontDestroyOnLoad(gameObject);
|
DontDestroyOnLoad(gameObject);
|
||||||
|
@ -46,6 +51,8 @@ namespace IllusionInjector
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
plugins.OnApplicationQuit();
|
plugins.OnApplicationQuit();
|
||||||
|
|
||||||
|
Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLevelWasLoaded(int level)
|
void OnLevelWasLoaded(int level)
|
||||||
|
|
|
@ -60,7 +60,6 @@ namespace IllusionInjector
|
||||||
Console.WriteLine(" {0}: {1}", plugin.Name, plugin.Version);
|
Console.WriteLine(" {0}: {1}", plugin.Name, plugin.Version);
|
||||||
}
|
}
|
||||||
Console.WriteLine("-----------------------------");
|
Console.WriteLine("-----------------------------");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<IPlugin> LoadPluginsFromFile(string file, string exeName)
|
private static IEnumerable<IPlugin> LoadPluginsFromFile(string file, string exeName)
|
||||||
|
|
Loading…
Reference in a new issue