Question by
MrTiger_ · Jul 24, 2018 at 05:36 PM ·
randomrandom spawn
spawn random object and move it
I need help with scripting on how to spawn a cube at a random position (In 3d) .. say its a falling object. And how could you make this as efficient as possible?? :D
Comment
doesn't have to be multiple objects at once.. could just be one at a time
Answer by bennett_apps · Aug 02, 2018 at 07:13 PM
float x = Random.Range (-10, 10);
float y = Random.Range (-10, 10);
float z = Random.Range (-10, 10);
Instantiate (somePrefab, new Vector3 (x, y, z), Quaternion.identity);
Your answer
![](https://koobas.hobune.stream/wayback/20220612171431im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Random Item Appear (JavaScript), 아이템 랜덤 등장 (자바스크립트) 0 Answers
Instantiate objects in given range 1 Answer
Random bitmap generator 0 Answers
Damn Compiler Errors, pls help me 0 Answers
Random Generation problem GameObject 0 Answers