- Home /
Random objects in coordinates specific
how I make appear random objects at the coordinates -0.9 and 0.9.
My idea is to make objects appear randomly but only at the coordinates I mentioned above, I want them to appear only on these positions.
the attached image is an example of what I want. Sorry for my english, i speak spanish.
I want to create is a game of car traveling in the opposite direction of the character.
The idea is to dodge these cars but if I use the Random.Range function the cohces appear at random positions between the coordinates -0.9 and 0.9.
So the ideal is trip only at two positions on the x-axis and not between two positions
I'm sorry but I have not found Spanish help.
Answer by unimechanic · Jan 05, 2015 at 07:24 PM
how I make appear random objects at the coordinates -0.9 and 0.9
Suppose you have an array of prefabs, instantiate them randomly and place them in the required position. This is what you need to learn:
http://docs.unity3d.com/Manual/InstantiatingPrefabs.html
http://docs.unity3d.com/ScriptReference/Random.Range.html
http://docs.unity3d.com/ScriptReference/Transform-position.html
Your answer
Follow this Question
Related Questions
Random.Range is not changing? 1 Answer
RNG State Changes When Loop Iteration is Skipped? 0 Answers
Random Sound When Click? 0 Answers
Random Generation Algorithm Error 3 Answers
Instantiate Prefab at random times but keep 3 from spawning 2 Answers