StackOverflowException: The requested operation caused a stack overflow.

Unity 项目中

private int _id = -1;
public int id { get => _id;}

不知这种方式为何突然报错,导致编辑器崩溃,查了好久,最后终于查到是这里取id导致的

换了一种方式就正常了,改了变量名

private int _unitId = -1;
public int unitID
{
   get { return _unitId; }
}

猜你喜欢

转载自blog.csdn.net/dj1232090/article/details/121272153