Instantiate random non-duplicated prefabs from the list.

Job ID: 31194471

Budget: $10 – $15 USD

Hello, I’m developing unity game and I have two tasks to do.

There are 3 scenes: main menu, level 1 and level 2 scenes. Player can choose 1 of 50 colors in main menu. There are two buttons which lead to level 1 and level 2 respectively.

First task: When player clicks on the first button it transfers to level 1 scene. You need to populate list with random non duplicated 29 integers from the range (from 1 to 50) excluding duplicates and excluding one integer which player has chosen in the previous scene (using public static int). Then instantiate 29 prefabs out of 50 regarding to numbers from the list. You also need to instantiate them as separate 29 GameObjects. I have done all of this, except excluding duplicates so you can examine mine code.

Second task: When player clicks on the second button it transfers to level 2 scene. Here you just need to randomly pick 4 numbers out of 50 excluding duplicates and one integer which player has chosen in the previous scene.

I’ll attach unity project for this task. Unity version is 2021.1.15f1
Related categories: C# Programming Unity 3D Game Development