Hello dear Community
first of all i want to introduce myself. My name is Eddy, I’m 25 years old, from Germany and quit new in Unity3D and C#. I have work a long time with the Game Maker Studio Engine and I decided to finally go to Unity3D. I have seen a lot of tutorials and till now I works all the way I wanted. But now I got a problem and I dont know why it exists. I am using the Free Version 5.5 of Unity. I hope that I can explain my problem correctly.
My code looks simply like this:
public class GameController : MonoBehaviour {
public enum Status {start, attacke, action, wait, value, nix , playerWin, enemyWin};
public Status state = Status.start;
public Text text = "";
void Start(){
StartCoroutine(GameStart());
}
void FixedUpdate(){
switch (state)
{
case Status.attacke: text.text = "Jump";
state = Status.action;
break;
case Status.action:
// (Hier passiert die ganze Action)
break;
}
}
IEnumerator GameStart()
{
text.text = "3";
yield return new WaitForSeconds(1);
text.text = "2";
yield return new WaitForSeconds(1);
text.text = "1";
state = Status.attacke;
}
}
So my problem is now, the code itself work’s but not everytime.
A few times all this works like it should and a few time it stops in GameStart() before the state change to Status.attacke; Has anyone an idea why this is so ? … OK I think I solved this problem… all works right when i have the switch in the update but not in the fixedupdate now i just set a bool in the update on true so it works