No Errors but code not working, Unable to progress with my adventure

The corridor_1 text don’t appear in the game window?

No, only in console

What is displayed in the game window? Can you pop a screenshot up perhaps.

to walk you through the process

Z doesn’t work, I’m not sure what’s missing.

I see 2 compiler errors listed in your console output. Is that from past attempts or does that occur each time you run it?


Updated Mon Nov 21 2016 22:22

Just looking through the latest link to your code and I noticed that you have three states which do not have corresponding methods, and the method void corridor_1() also calls these methods. That would probably cause the 2 compiler errors as per the screenshot, but I don’t know whether you have added those methods since that post etc.

The missing methods were;

  • red_door()
  • green_door()
  • black_door()

I wouldn’t expect the game to run at all with the compiler errors, so I’m not certain that the code I am viewing is the same version that you are running for the screenshots etc.

void corridor_1() has three instances where you refer to Input.GetKey(KeyCode.Z) as opposed to Input.GetKeyDown(KeyCode.Z) also - just as a heads up.

Updated Mon Nov 21 2016 22:35

One other thought I had… when you have made the changes above, was the game still running? e.g. game running in Unity, code being changed in MonoDevelop/Visual Studio at the same time? The reason I ask is that if this was the case, Unity would still be running the previous version of the code from it’s cache/last build, not the code you just changed.

1 Like

fixed! Missing semi colon AND I hadn’t defined the states later on,

Thanks for help!

1 Like

Glad you have resolved the issues @MoSa_Audio :slight_smile:

1 Like

Privacy & Terms