Game isn't changing states

I’m at the end of lecture 27 (Manage Next States), and when I’m pressing 1 or 2 to change states and ‘go’ into the next room, nothing happens.

I included a Debug.Log message under each “if” condition, so that I know if the keys have been pressed. No message is coming through, however, so I have to assume that either something’s wrong with the GetKeyDown conditions, or that there’s some other more generic problem. No error message appears, though.

Can anyone help me, please? Thanks in advance!

1 Like

Hi there! Welcome to the community!

I don’t see any issue with your code, so it might be something else. Did you forget to add the script to an object in your scene? It might also come down to which key are you pressing, Alpha refers to the numbers at the top of your keyboard, if won’t work for numpad.

Hi Yee,
Thank you for the prompt advice!

It looks like I did indeed forget to add the StoryText box to my Game event. Actually I didn’t, but my computer reset itself at some point and I guess it loaded an old version of the Unity project.

Thanks again!

Hi Roey,

I’m glad Yee was able to help you. Is the issue fixed now?

See also:

It is. Thank you.

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

Privacy & Terms