top of page
Search

Looping Challenges

Writer: Keshav Batra
Keshav Batra
Oct 15, 2021
1 min read

The next thing I'm currently learning about is how to manage loops. The loop that I decided to use for this particular project is the ForLoop.




 int NumberOfObjects = 15;
    public GameObject Cube;

    void Start()
    {
       
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            for (int i = 0; i < NumberOfObjects; i++)
            {
                Instantiate(Cube);
            }
        }
    }




 
 
 

Comments


bottom of page