Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Instantiate random object using VS

Discussion in 'Getting Started' started by SacramentoCA, Apr 28, 2023.

  1. SacramentoCA

    SacramentoCA

    Joined:
    Apr 6, 2023
    Posts:
    4
    Hello, Everyone!

    Imagine a game like Tetris. Different figures drop from the top of the screen. Now I have only 2 types of figures. I use Visual Scripting for the whole game. I want it to spawn randomly with certain chances, and for these 2 figures I use a plain Random node (screen). But with adding any other figures, I wonder how I could make it simplier.

    I saw some pretty simple C# scripts when every time it spawns an object it takes a random object in fact (with equal chances), without picking a number. But I'm not sure if I could easily regulate the chances of every object that easily. I have some ideas how to regulate the chances with this Random node and set of "if" conditions, but it will become a little massive.

    Just started to learn unity recently. Appreciate any kind of help and any advices are welcome!

    Thanks for reading!
     

    Attached Files: