[Solved] get's stuck when i press a button

when i press c it doesn’t do anyhing afterwards and not sure if it works after that

1 Like

Hello @YourEngineer, how are you?

You addressed three ifs to the cement state under the update method, one of those should be the mirror state that you would continue the game workflow, so if you press M while you are inside the cement state, it will just reenter into it and it will seems that nothing has changed. You should fix both mirror if statements under the update in order to solve this problem

Hi @Joao_Dalvi, how are you?

I’m having a similar problem when I press M to view Mirror nothing happens, while pressing S and L work, the M one does not work, how am I supposed to fix that?

Thank you.

Here is the code: https://gist.github.com/RilindAsllani/14623cf1d620baf70a29441c52df4f92.

Hello @RilindAsllani, how are you?

I took a look at your code and I think that I’ve found the problem:

void Update () {
		print (myState);
		if (myState == States.cell) {
		} else if (myState == States.sheets_0) {
		} else if (myState == States.lock_0) {
		} else if (myState == States.lock_1) {
			myState = States.lock_1;
		} else if (myState == States.mirror) {
			myState = States.mirror;
		} else if (myState == States.cell_mirror) {
			myState = States.cell_mirror;
		} else if (myState == States.freedom) {
			myState = States.freedom;

Your if for States.lock_1 and below is returning the myState itself instead of returning the method that you want to run once the player is in that state.

else if (myState == States.mirror) 
			myState = States.mirror;

should be:

else if (myState == States.mirror) 

Just like you did with the States.cell, States.sheets_0 and States.lock_0. Let me know if this fixes the problem.

1 Like

Thank you very much, it is fixed.

All the best!


Privacy & Terms