Search Unity

Question 2D enemy ai PreFab

Discussion in '2D' started by CodeMateo, Jun 19, 2020.

  1. CodeMateo

    CodeMateo

    Joined:
    May 21, 2020
    Posts:
    77
    Hey guys, I'm really new to C# and coding and I'm having trouble. I'm trying to make a game that spawns in the enemy randomly within a randomly generated dungeon, and I want to make the enemy patrol an area of 10 by 10. The problem is that the enemies are prefabs, so I can't just make it a -5 to 5 position as the enemy will move to starting spot (and waypoints won't work as they're prefabs and they'll just chase the child waypoint endlessly). Also this is a 2D game, so navmesh won't work. All help would be appreciated.
     
  2. jbnlwilliams1

    jbnlwilliams1

    Joined:
    May 21, 2019
    Posts:
    267
  3. CodeMateo

    CodeMateo

    Joined:
    May 21, 2020
    Posts:
    77