Unity - A计划(一年有效期) 扫二维码继续学习 二维码时效为半小时

(61评价)
价格: 2208.00元
游戏开发中的设计模式:堆栈溢出问题
克莱宝宝发起了问答2018-11-24
2
回复
406
浏览
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课左右,当点击兵营生产士兵时,过几秒会报以上错误

所有回复
发表回复
你还没有登录,请先 登录或 注册!