Check out example codes for "how to make a singleton in unity". It will help you in understanding the concepts better.
Code Example 1
void Awake()
{
if (instance == null)
instance = this;
else if (instance != this)
Destroy(gameObject);
}
Code Example 2
#region Singleton
void Awake()
{
if (instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
return;
}
DontDestroyOnLoad(gameObject);
}
#endregion
Learn ReactJs, React Native from akashmittal.com