Why cannot switch states

I do not know what’s wrong with my code that causes I cannot switch states! Who can help me fix it, appreciate it. 3|690x188

Ops, I missed one image

The problem is that there are only 2 states defined per Room, instead of 3.

Remove the part:

        else if (Input.GetKeyDown(KeyCode.Alpha3))           // alpha1 = number 1 on keyboard
        {
            state = nextStates[2];
        }

OR you can add another State (via create menu in unity), name it Room 3, and add 1 extra room to each room-array.

Privacy & Terms