Domvel
1
I just trying to create a singleton for static global variables.
public class SingletonController : MonoBehaviour {
public static SingletonController instance { get; private set; } // <- fails
// etc.
}
Error:
SingletonController name conflict with the class name SingletonController.
(Conflict with Assembly-CSharp-firstpass)
Unity Version2018.2.13f1
Don’t even give them the set option…
private static SingletonController instance = null;
public static SingletonController Instance
{
get { return instance; }
}
void Awake()
{
if (!instance)
{
instance = transform.GetComponent<SingletonController>();
DontDestroyOnLoad(instance);
}
else
Destroy(gameObject);
}
Domvel
3
Thanks for response, but the set option isn’t the problem. At the moment, it seems so. Maybe a pseudo error?
See the underlined conflicts with the name. (of my first post)
Domvel
4
Solution: Just restart Unity. If it still crying try to delete the Library folder from the project.