I want to make all instances of a prefab to move for a 2D flight combat game I’m making. This prefab is the bullet and I’m having problem making all the clones to move.
Right now only the first clone moves correctly the others go to the position I want, the rotation I want but they don’t move, they just stay in same position.
Here is the code:
if (Input.GetKeyDown(“space”)) {
Instantiate (GameObject.Find(“Cube”),GameObject.Find(“Test_Aircraft”).transform.position, GameObject.Find(“Test_Aircraft”).transform.rotation) ;
}
GameObject.Find(“Cube(Clone)”).transform.position = new Vector3 (GameObject.Find(“Cube(Clone)”).transform.position.x + (GameObject.Find(“Cube(Clone)”).transform.right.x * (float)1.75), GameObject.Find(“Cube(Clone)”).transform.position.y + GameObject.Find(“Cube(Clone)”).transform.right.y* (float)1.75 , GameObject.Find(“Cube(Clone)”).transform.position.z + (GameObject.Find(“Cube(Clone)”).transform.right.z* (float)1.75));
//The Test_Aircraft is the player