1. 无法最小复现的bug(新建项目无法看到类似情况,如图一)

2. 生成流程:对象A生成场景A、对象B → 对象B根据场景ID生成敌人生成对象(对象C)→ 对象C生成敌人D
3. BUG表现:对象C生成敌人D时,我方友军在地图中心会对空气开枪(如图2)

4. 前提:我方队友由一个对象生成;队友逻辑——正面200范围内无敌人且正面有敌人→移动动作;仅正面200范围内有敌人才攻击
5. 实际异常:队友背对敌人D时,在地图中心位置会开枪或是跟踪敌人D
6. 额外测试:将对象C(生成敌人D)放到很远的地方,生成敌人时,队友仍在地图中心开枪(仿佛敌人先在地图中心生成,再移动到指定位置)
7. 排查操作:开启可视碰撞框等,未找到线索
关键线索:若队友直接放在场景里(不由其他对象生成),路过中心不会受影响(唯一发现)
8. 我的猜测:怀疑敌人在地图中心生成
-
尝试删除对象A、对象B,仍出现问题(排除单纯路径问题)
-
保留对象A、对象B,仍出现问题
9. 补充:此前录制视频时,也发现队友对空气开枪,起初以为是敌人删除不干净,实际不是
求助官方帮帮喵,谢谢喵(已排查到现在,无更多线索)
///
JP:
新規プロジェクトでは再現しないバグが発生しており、手がかりが見つからず困っています。
1. 生成フロー
-
オブジェクト A が シーン A と オブジェクト B を生成
-
オブジェクト B がシーン ID に応じて敵を生成する オブジェクト C を生成
-
オブジェクト C が 敵 D を生成
2. 不具合内容
-
自軍の味方が マップ中心付近にいると、何もない空中を撃つ (画像 2 参照)
-

-
本来のロジック:
-
正面 200 以内に敵がいない & 正面に敵がいる場合 → 移動
-
正面 200 以内に敵がいる場合のみ攻撃
-
-
実際:
味方が敵 D を背にしているにもかかわらず、マップ中心で勝手に攻撃・追尾 してしまう
3. 試したこと
-
オブジェクト C をマップから極端に遠い位置に配置して敵 D を生成しても、
味方はマップ中心で攻撃(まるで敵が中心にスポーン後、移動したかのよう)
-
コライダー・当たり判定表示をオンにしても手がかりなし
-
敵オブジェクトの削除漏れではないことを確認済み
4. 重要な再現条件(唯一再現しないパターン)
-
味方を エディタでシーンに直接配置 した場合 → 不具合は起きない
-
味方を 別オブジェクトから動的に生成 した場合のみ不具合が再現
5. 推測
-
何らかの理由で 敵の位置が一時的にマップ中心 (0,0) として認識 されている可能性あり
-
オブジェクト A・B の削除有無に関わらず再現するため、単純なパスの問題ではない
補足
以前、動画収録時にも同様に味方が空中を撃つ現象を確認していました。
当初は敵の削除漏れだと思っていましたが、原因はそうではありませんでした。
どなたか原因や調査方法を教えてください… お願いしますにゃん![]()
///
I have a bug that doesn’t appear in a clean/new project, and I can’t find any clues after hours of debugging. Please help me!
1. Spawn Flow
-
Object A spawns Scene A and Object B
-
Object B spawns Object C (enemy spawner) based on scene ID
-
Object C spawns the actual enemy Enemy D
2. Bug Behavior
-
My ally unit shoots at empty air when near the map center (see Image 2)
-

-
Correct intended logic:
-
If no enemy within 200 range in front + enemy exists in front → move
-
Only attack if enemy is within 200 range in front
-
-
Actual behavior:
Ally faces away from Enemy D, but still attacks / chases nothing at map center anyway.
3. Things I’ve tested
-
I moved Object C (enemy spawner) very far away from the map, but the ally still shoots at the map center when enemies spawn.
It behaves like the enemy spawns at center first, then teleports/moves to the real position.
-
Turned on collider/debug shapes – no visible issues.
-
Confirmed it’s NOT leftover/destroyed enemy objects not cleaned up.
4. Critical clue (only case that works correctly)
-
If I place the ally directly in the scene in Editor (not spawned dynamically),
it passes the map center with no abnormal attacking.
-
Bug only happens when ally is spawned dynamically by another object.
5. My guess
-
I suspect enemy position is temporarily registered as map center (0,0) for some reason during spawning.
-
Happens even if I delete Object A / B, so it’s not a simple path issue.
Extra note
I’ve seen this before in recordings: ally shooting at air as if an enemy was there.
I thought it was leftover enemies at first, but that’s not the case.
I’ve been stuck on this since noon… please help me out, nyaa~ ![]()