void Awake()
{
if (Instance)
{
DestroyImmediate(gameObject);
}
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
}
i have same issue i have made a ui button with name of back now, my wish to destroy every object when i click on back button