Problems with clones

Good Evening everyone, I have a problem: I’m creating my own game where the Player can launch needles, the needle can be moved left and right by keyboard inputs and then when the button is released the needle goes upwards and another one is cloned to replace it, and here’s the problem when I have multiple clones launched, they all follow the movement of the clone that hasn’t started yet even if the clones after that the button is released, the X position can no longer be changed. Can anyone help me? Tell me if you understand or if you want the code.

You could add a boolean to the needle so that it knows whether or not it has been launched yet. If the needle has been launched, then it should ignore any keyboard inputs.

In this code there is a Boolean but It doesn’t work

You aren’t using the isOriginal boolean to determine if “move” should be applied to the object. I would expect something like this:

Vector2 position = rigidbody2d.position;
if(isOriginal)
    position += move * 3.0f * Time.fixedDeltaTime; //use fixedDeltaTime for FixedUpdate()

Thanks, tomorrow I will try this solution and I will tell you if it works

What do you think about my code?Tell my your opinion or some advices

Honestly, I think you should split the script into two objects 1) the player that moves around and spawns projectiles 2) the projectile itself. This is fairly common practice to have a spawner object which creates copies of some prefab. Trying to mix these two behaviors in a single script is confusing and prone to problems later.

Ok, thanks