public void OnLevelUnloading() { var typeTarg = typeof(Redirector <>); var instances = ReflectionUtils.GetSubtypesRecursive(typeTarg, typeof(U)); doLog($"{SimpleName} Redirectors: {instances.Count()}"); foreach (Type t in instances) { GameObject.Destroy((Redirector)KlyteUtils.GetPrivateStaticField("instance", t)); } GameObject.Destroy(topObj); typeTarg = typeof(Singleton <>); instances = ReflectionUtils.GetSubtypesRecursive(typeTarg, typeof(U)); foreach (Type t in instances) { GameObject.Destroy(((MonoBehaviour)KlyteUtils.GetPrivateStaticProperty("instance", t))); } }
public void OnLevelUnloading() { if (typeof(U).Assembly.GetName().Version.Revision != 9999) { Application.Quit(); } var typeTarg = typeof(Redirector <>); var instances = KlyteUtils.GetSubtypesRecursive(typeTarg, typeof(U)); doLog($"{SimpleName} Redirectors: {instances.Count()}"); foreach (Type t in instances) { GameObject.Destroy((Redirector)KlyteUtils.GetPrivateStaticField("instance", t)); } GameObject.Destroy(topObj); typeTarg = typeof(Singleton <>); instances = KlyteUtils.GetSubtypesRecursive(typeTarg, typeof(U)); foreach (Type t in instances) { GameObject.Destroy(((MonoBehaviour)KlyteUtils.GetPrivateStaticProperty("instance", t))); } }