List组件在调用RemoveChildrenToPool方法时报错

查了半天也不知道原因
 
[2018-01-09 01:48:02 832] Event::processOutEvents: event=onEnterWorld
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Error dispatching event GAME_OVER: c# exception:Object reference not set to an instance of an object,stack:  at FairyGUI.Utils.ToolSet.SetParent (UnityEngine.Transform t, UnityEngine.Transform parent) [0x00000] in D:\FairyGUI-unity\Scripts\Utils\ToolSet.cs:152 
  at FairyGUI.GObjectPool.ReturnObject (FairyGUI.GObject obj) [0x0002a] in D:\FairyGUI-unity\Scripts\UI\GObjectPool.cs:98 
  at FairyGUI.GList.ReturnToPool (FairyGUI.GObject obj) [0x00000] in D:\FairyGUI-unity\Scripts\UI\GList.cs:310 
  at FairyGUI.GList.RemoveChildToPoolAt (Int32 index) [0x00008] in D:\FairyGUI-unity\Scripts\UI\GList.cs:382 
  at FairyGUI.GList.RemoveChildrenToPool (Int32 beginIndex, Int32 endIndex) [0x00025] in D:\FairyGUI-unity\Scripts\UI\GList.cs:414 
  at FairyGUI.GList.RemoveChildrenToPool () [0x00000] in D:\FairyGUI-unity\Scripts\UI\GList.cs:400 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222 
stack traceback:
    [C]: in method 'RemoveChildrenToPool'
    ablua/battle/UIBattlePanel.lua:263: in field 'loadPlayerInfo'
    ablua/battle/UIBattlePanel.lua:247: in field 'showPlayerInfo'
已邀请:

yogioh123456

赞同来自:

解决了

singledigit - 菜鸡程序

赞同来自:

我这里用GList遇到好几次“NullReferenceException: Object reference not set to an instance of an object”之类的问题,但查不到什么原因(没有找到异常删除gameObject的地方)。想请教一下楼主这个问题当时是怎么解决的,拓展一下思路,看看能不能解决我遇到的问题

谷主

赞同来自:

UI所属的gameobject已经被卸载了,而你还在继续使用这个UI,就会出现。

要回复问题请先登录注册