public static GameManager instance;
private void Awake()
{
instance = this;
}
或者定义属性Instance访问
private static GameManager instance;
public static GameManager Instance { get => instance; set => instance = value; }
private void Awake()
{
Instance = this;
}