Singleton Script:
public static ShipSingleton Instance { get { return _instance; } }
private void Awake()
{
if (_instance != null && _i
Oh, I see what the problem is now (and I'll fix it in the other question too) --
This line needs to reference ShipSingleton.Ship
instead of just Ship
:
public Ship ShipID = ShipSingleton.Ship.BasicShip;
So it should look like this:
public ShipSingleton.Ship ShipID = ShipSingleton.Ship.BasicShip;
This is because the enum type Ship
is a member of ShipSingleton
. It would not be necessary if Ship
were declared at the namespace level like this:
public enum Ship
{
BasicShip
};
public class ShipSingleton
{
public static ShipSingleton Instance { get { return _instance; } }
private void Awake()
{
if (_instance != null && _instance != this)
{
Destroy(this.gameObject);
}
else
{
_instance = this;
DontDestroyOnLoad(this.gameObject);
}
}
Ship spawnShipID;
}