由于NGUI的OnDragDropRelease()的物体不随着鼠标移动,因此
使用过UICamera.hoveredObject改变NGUI的OnDragDropRelease()的物体随鼠标坐标移动
什么鼠标精灵的物体为空null,没有实例化
背包系统就崩溃了
NullReferenceException: Object reference not set to an instance of an object
UIDragDropItem.OnDragDropStart () (at Assets/NGUI/Scripts/Interaction/UIDragDropItem.cs:279)
UIDragDropItem.StartDragging () (at Assets/NGUI/Scripts/Interaction/UIDragDropItem.cs:213)
UIDragDropItem.OnDragStart () (at Assets/NGUI/Scripts/Interaction/UIDragDropItem.cs:162)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
NullReferenceException: Object reference not set to an instance of an object
UIDragDropItem.OnDragDropMove (Vector2 delta) (at Assets/NGUI/Scripts/Interaction/UIDragDropItem.cs:311)
UIDragDropItem.OnDrag (Vector2 delta) (at Assets/NGUI/Scripts/Interaction/UIDragDropItem.cs:233)
UnityEngine.GameObje

Unity NGUI的OnDragDropRelease在拖拽时可能导致背包系统崩溃,出现NullReferenceException。问题源于UICamera.hoveredObject为空,未正确实例化。解决办法包括:定期备份工程,尝试在新工程中复用旧物体,或者切换到UGUI组件进行背包系统构建。避免使用UICamera.hoveredObject直接修改物体随鼠标移动,以防止Unity内部逻辑崩溃。
最低0.47元/天 解锁文章
3415

被折叠的 条评论
为什么被折叠?



