Simple scene… player object, a few obstacles and an enemy using raycast to detect/attack the player - All good.
Next scene… player object, a few obstacles and maybe as many as 52 enemies all using the same raycast method to detect/attack the player.
Is this going to be over-taxing on my game/resources
???
Should not since Raycast is just multiplication and division of a few values.
The real question is do you need casting each frame? Could you maybe make them less frequent like only 4 times per second (already a cast each 25ms which sounds enough).
private float freq = 0.25f; // 4Hz void Update(){ timer +=time.deltaTime; if(timer> freq){ timer = 0; AIMethod(); } }