Hello I have a doubt from the unity 2d course. Please help!

Hello I am taking the unity 2d course from udemy and I’ve got a doubt from the text 101 game. I don’t understand how the following code works.

 for (int index = 0; index < nextStates.Length;index ++;)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1 + index))
            {
                state = nextStates[index];
            }
        }

Please explain

Hi anwin,

Please read the answers in this thread. Did they clear this topic up for you?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms