Hello.
I’m writing simple arena like game. Inside arena there will be my tanks and enemy tanks. Tanks has part that moves whole body and turret part that is child of moving body. Tanks will move randomly. Turrets also got attack range. What is the most effective way to detect and attack enemies that will not affect for performance of game?
I have one idea.
Every turret will store all GameObject references of all enemies. There will be function that will be called inside Update that will detect enemy that is closest and inside attack range. However, I think calling at update searching function is not effectvie.
Also, Happy New Year !!