As seen on this article: https://blogs.unity3d.com/2017/11/20/making-cool-stuff-with-scriptableobjects/
I’ve recently got rid of my project’s singletons, converted my shared classes to ScritableObjects with the following helper script. This change removed all of my runtime reload errors I used to have.
// Just an example code
public class SingletonScritableObject<T> : ScriptableObject where T : ScriptableObject {
private static T _instance;
public static T Instance {
get {
if (!_instance) {
var objs = Resources.FindObjectsOfTypeAll<T>();
if (objs.Length!=0) _instance = objs[0];
}
if (!_instance) _instance = ScriptableObject.CreateInstance<T>();
return _instance;
}
}
}
// Or even a class that contains all references
public class GlobalReferences : ScriptableObject {
public WorldController WorldController;
public GameController GameController;
public IntelManager IntelManager;
}
// Usage ( you can either have it existing as an asset, or create a new one for cases like this one )
SingletonScritableObject<GlobalReferences>.Instance.GameController.DoStuff();
Using this pattern you can have shared refs across your scene.
Perhaps if you do things this way, we’ll be able to have runtime reload working properly.