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; }
}

你可能感兴趣的:(Unity,unity,游戏引擎)