【BUG】Dynamically Spawned Ally Shoots Air & Chases Enemies at Map Center (Cannot Reproduce in Minimal Project)

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)
  • 1770386349235
  • 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~ :cat_face:

Could you send your project folder in a zip to pgmmv-support@gotchagotcha.jp so we can investigate why it’s happening in your project?

Sent. Thank you~ nyaa​:cat_face: