Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Spawning random numbers on predefined positions

Spawning random numbers on predefined positions

Go down  Message [Page 1 of 1]


Member [Lv. 0]
Member [Lv. 0]
Hi all,

I am in a kaffuffle...

I want to spawn random numbers say between 1-99 to display on the screen in predefined positions. So:
The code spawns either of the two prefabs on predefined positions using emptys.


        [SerializeField] GameObject PrefabA;
 [SerializeField] GameObject PrefabB;
 [SerializeField] Transform[] spawnPoints = new Transform[8];

for (int i = 0; i < spawnPoints.Length; i++) {
 Instantiate((Random.Range(0,2) == 0 ? PrefabA : PrefabB), spawnPoints[i].position, Quaternion.identity);

So how do i convert this to spawn random numbers ranging from 1-99... When the numbers are clicked it will add up and match the sum of 42?

View user profile


Member [Lv. 3]
Member [Lv. 3]
Well from what i can tell in Word format....

search for object with tag..
set a array for object in pool.
10 objects in pool... there are empty game objects
set a bool for each... this will let it know if its been clicked or not
set it to only accept 2 TRUE bool values
+ those 2 bool clicked values as true as it will contain already random numbers 

try to stay with one set and i think FLOAT is what random.range uses without formatting to INT..

View user profile

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum