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()
|
||||
{
|
||||
var singleton = new GameObject("PluginManager");
|
||||
singleton.AddComponent<PluginComponent>(); ;
|
||||
PluginComponent.Create();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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…
Reference in a new issue