[Solved] Error for unknown reason after changing Freedom to Corridor_0

So I have my script almost completely identical to the video tutorial, I added an extra State which I don’t think is the issue? It worked fine with the Freedom State and the game would end and start over and such. When changing Freedom to Corridor_0 I am getting this problem seen in the screenshots and I am wondering what is going wrong here.


[Observed]
I have the code written properly as far as I am aware, everything seems to be in order.
However I keep getting this error.

[Desired]
Obviously I need to get the game working but am unsure what the issue is.

[Steps to Reproduce]
I have no idea actually how to reproduce this effect. It should be working just fine, there is something I am missing but I can’t seem to put my finger on it.

[Relevant Information]
Unity 4.6.9f1

Code:https://gist.github.com/anonymous/fc5611cc2ae5afdcab2b00ba443a416d
Not sure why the code isn’t tabbed properly when I move it onto this site?

[Steps Tried Already]
Well the first thing I thought was maybe I spelled something wrong or I forgot a ;
so I went through my code and yes at first I had forgotten a ; when I changed it to
corridor_0.
The problem still persisted, it took away one of my errors but I was left with the current one.
I thought maybe monodevelop for whatever reason didn’t like the name of the state?
So I changed it from corridor_0 to just corridor, and then later to hallway trying different things.
I also changed it appropriately down in the states and every mention that needed to change to
corridor_0. But none of the name changes fixed anything. So that wasn’t the issue.
I then tried removing all instances of that state and mentions of that state and completely removed
corridor_0 from the code entirely and it will run fine up to the last portion where you would need
corridor_0 to continue the game. So the game will run without corridor_01 but even for me to try
to add another state just will not allow me to do so. What am I missing here?
P.S. When I first got Unity it was version 4.6.3f1 from the beginning, not sure why and how it changed without me telling it to. Also not sure if that has anything to do with the issue here, but I thought I should mention it anyway.

Hi,

On line 31, you call the method but haven’t placed the ( and ) characters after it.

It should read;

else if (myState == States.corridor_0) { corridor_0(); }

Hope this helps.


See also;

Derp! Ahh I can’t believe I missed that! Thank you so much! Haha, ah ****.

1 Like

You’re more than welcome :slight_smile:

Privacy & Terms