public void Unload() { if (plugin != null) { var container = EcsRxApplicationBehaviour.Instance.Container; var systemExecutor = EcsRxApplicationBehaviour.Instance.SystemExecutor; plugin.GetSystemsForRegistration(container) .ForEachRun(x => systemExecutor.RemoveSystem(x)); plugin.UnsetupDependencies(container); plugin = null; } }
T load <T>() where T : IEcsRxPlugin, new() { Unload(); plugin = new T(); var container = EcsRxApplicationBehaviour.Instance.Container; var systemExecutor = EcsRxApplicationBehaviour.Instance.SystemExecutor; plugin.SetupDependencies(container); plugin.GetSystemsForRegistration(container) .ForEachRun(x => systemExecutor.AddSystem(x)); return((T)plugin); }