Remnant Empty Game Objects for Static Scripts

One of my current projects is using a static, singleton class “System Manager” to handle control and data flow between several different classes in my game. It is attached to an empty Game Object. Everything works fine, EXCEPT between scene transitions, I end up with several blank game objects. It doesn’t affect anything functionally, but it just seems like there would be a more “correct” way of doing what I have in mind that would prevent such a thing from happening. The only workaround I have is to have a function that constantly looks for empty Game Objects called System Manager and destroys them.

You should check for duplicate instances in Awake() and remove them if found. This will ensure you only have one instance in the scene.

public static SystemManager instance;

void Awake()
	{
		if (instance != null) {
			DestroyImmediate(gameObject);
			return;
		}
		instance = this;

		DontDestroyOnLoad(gameObject);
    }