FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionSpawning random numbers on predefined positions

more_horiz
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.

Code:


        [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?

descriptionRe: Spawning random numbers on predefined positions

more_horiz
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..
Permissions in this forum:
You cannot reply to topics in this forum