unity why not use singleton code example
Example: how to make a singleton in unity
void Awake()
{
if (instance == null)
instance = this;
else if (instance != this)
Destroy(gameObject);
}
void Awake()
{
if (instance == null)
instance = this;
else if (instance != this)
Destroy(gameObject);
}