I am trying to create a side scrolling game sort of like Gradius and I am spawning in enemies at random positions at the edge of the screen so it looks like they fly in. Right now I only have one enemy spawning in but I am copying the same enemy in with its prefab from the hierarchy and spawning it in with a gameController object and script. The problem I am having is when I shoot the enemies they seem to be inheriting the Scripts and properties of the GameObject prefab that was spawned just before causing the player to have to shoot the one in front or wait for it to be destroyed before attacking the enemies in the back. If the player shoots the ships in the back first, it causes the ship in the front to blow up, basically in order (also giving me a 'Could not find GameObject' error). I will supply code if needed, I am hoping it is a simple fix, I haven't been able to find any solid solution online and I have been searching for days. I would greatly appreciate any help I can get.
↧