how to spawn objects horizontally ?

Hi
i want to spawn objects but horizontally on the screen , like moving birds or cars etc… in the background , how can i do this ? is there any property to change it for gravity ? or add specific code to the spawner ?

Not sure what gravity has to do with it. If you want to position objects, just use their transform to position them. Or specify their position in the Instantiate() call.

1 Like

If you want them to move across the screen you need to move them along the x-axis over time, similar to moving the player but without needing the key inputs.

1 Like

i know , but i usually use code to spawn objects by assign the spawned objects,then let them move vertically by using gravity , but i dont know how to make these objects move , whats the code to let them move in x or y axis

Depends how you want to do it. At the moment my stuff is all simple so I use something like transform.position += (or -= depending which way I want to move it) speed*time.deltaTime
But I believe there are other ways that work better depending if it is a rigid body & stuff.
Hope that helps a bit anyway

1 Like

i also found that i can do such thing by animation , anyway thank you all :slight_smile: