2D instantiate and setting a variable to the instantiated object

I’ve been working on a game where players launch attack ships to objectives. withWhatToCollide variable is a GameObject type variable that holds the GameObject witch the ship is going to and needs to collide with (there may be other objects in the way…).

The problem is when a ship is summoned and another ship is summoned (by AI or the same player) if The first ship didn’t reach its targeted GameObject it will overwrite to the one assigned to the second ship.

//calculating degrees and ect. ...
var LaunchedShip : Rigidbody2D = Instantiate(AtkPreFab, StartBase.transform.position, degree);
LaunchedShip.GetComponent(destroyOnCollisionWithBase).withWhatToCollide = withWhatToCollide;

Most likely LaunchedShip.GetComponent(destroyOnCollisionWithBase).withWhatToCollide is set to static. Remove the static keyword if present.

If not, please provide relevant code of the destroyOnCollisionWithBase script.