private static RetroSnakerController _Instance;
public static RetroSnakerController Instance
{
get
{
if (_Instance == null)
{
var manipulationSystems = FindObjectsOfType<RetroSnakerController>();
if (manipulationSystems.Length > 0)
{
_Instance = manipulationSystems[0];
}
else
{
Debug.LogError("No instance of ManipulationSystem exists in the scene.");
}
}
return _Instance;
}
}
public static FoodController Instance;
private void Awake()
{
// if the singleton hasn't been initialized yet
if (Instance== null)
Instance= this;
}