My game is an FPS in which enemies are spawned and the player kills them. In order for the player and the enemies to apply damage to each other, both need a script in which a GetComponent is used to access one another’s variables for health and damage etc. Since the enemies eventually are destroyed and new ones are spawned, I need a way to have the player’s script getcomponent again every time a new enemy is spawned.
So far, I have not figured this out. If anyone can help me then that would be greatly appreciated.