StackOverflowException: The requested operation caused a stack overflow.
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
FactroyManager.get_attrFactroy () (at Assets/script/Factory/FactroyManager.cs:18)
。。。。。无限循环
public static class FactroyManager
{
static IAssetFactroy massetFactroy=null;
static ICharacterFactroy mSoldierFactroy=null;
static ICharacterFactroy mEnemyFactroy=null;
static IWeaponFactroy mweaponFactroy=null;
static IAttrFactroy mattrFactroy=null;
public static IAttrFactroy attrFactroy
{
get
{
if(attrFactroy==null)//18hang
{
mattrFactroy = new AttrFactory();
}
return mattrFactroy;
}
}
标注的第十八行。113课左右,当点击兵营生产士兵时,过几秒会报以上错误
同学你好,应该是某个变量名称命名错了,可以参考一下这篇文章:
https://blog.csdn.net/qq_28249373/article/details/78434867