当类继承与MonoBehaviour时this
public class TestSingle : MonoBehaviour继承
{get
public static TestSingle Instance;io
void Awake()class
{static
Instance = this ;vi
}new
}return
当类不继承与MonoBehaviour时void
public class TestSingle :
{
public static TestSingle instance;
public static TestSingle Instance
{
get
{
if(instance == null)
instance = new TestSingle();
return instance;
}
}
}