Files
zeling_v2/Assets/_Game
joywayerandClaude Opus 4.8 fccd87df6b fix(enemy): 修复退出 Play 时巡逻调试 Inspector 的 NRE 与 IMGUI 报错
退出 Play 有一个窗口:Application.isPlaying 仍为 true 但 PBWorld 已销毁,此时 Inspector
调 nav.CanReach → PBWorld.PathTo(instance=null) 抛 NRE;该异常在 IMGUI 布局组中途中断,
使 BeginHorizontal 组失衡 → 级联 ArgumentException("control N in a group with only N controls")。

修:
- 订阅 playModeStateChanged,ExitingPlayMode 置 _exitingPlay,CanReach 调用点加
  !_exitingPlay && isPlaying 守卫,退出期不再查询已销毁的 PBWorld。
- 运行时区块的绘制判定只在 Layout 事件锁定、Repaint 复用,避免 isPlaying 在两趟 GUI
  间翻转导致控件数不一致。

实测:选中敌人连续两次进/退 Play,Console 无 NRE/ArgumentException。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 15:33:41 +08:00
..
2026-07-20 10:33:18 +08:00
2026-06-05 18:41:33 +08:00
2026-06-06 09:00:11 +08:00
2026-06-09 10:41:43 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-06-05 18:41:33 +08:00
2026-06-06 09:00:11 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00
2026-05-15 14:47:24 +08:00