Game object not enabled after SetActive(true).

Hi,
I’ve a scene where I put a GameObject with a circle animated for the operations of loading. I have to active and deactive this GO in various points of my application so I put it in a singleton.

public sealed class SingletonManagerUI
{
....
private static SingletonManagerUI instance = null;
GameObject Loader {get;set;}
public static SingletonManagerUI Instance{
		get{		
			lock(padlock){
				if(instance == null){
				    instance = new SingletonManagerUI();
				}
			return instance;
		}
}
public void SetLoader(GameObject Lo){
		Loader = Lo;
}
public GameObject GetLoader(){
	return Loader;
}
...
}

When I active the GO it isn’t rendered in the scene. When the application start I put the GameObject with the loader in the scene:

GameObject Loader = GameObject.FindGameObjectWithTag("LoaderProgress");
SingletonManagerUI.Instance.SetLoader(Loader);

The scenario is the follow: the application start with the circle active and it works, I deactive it in a point of my application. In another point of my application I active it but it doesn’t rendered. Where is my mistake? I’m sure that circle is in the right position in the scene.
This is the istruction that I use:

SingletonManagerUI.Instance.GetLoader().SetActive(true);

The method GetLoader() return a GameObject.

Thanks a lot guys.

It’s probably being deactivated by something else. That’s the issue with using singletons… can be hard to trace. I’d suggest to add a new method SetLoaderActive(bool active) in your singleton. Replace all Instance.GetLoader().SetActive() calls with the new method. In the new method put a Debug.Log so you can trace out who’s deactivating it.