If you have something strange thread error, just edit your code like this:
Your Code:
void OnNewGameState(GameState gs)
{
//Your Code is inside the comments
if( checkbomb() )startbomb();
//end of codes
}
Fixed code:
void OnNewGameState(GameState gs)
{
Invoke(new Action(() =>
{
//Your Code is inside the comments
if( checkbomb() )startbomb();
//end of codes
}));
}
So just copy all your "OnGameStateUpdate" codes to the block:
Invoke(new Action(() =>
{
//code here
}));
If you have something strange thread error, just edit your code like this: Your Code: void OnNewGameState(GameState gs) { //Your Code is inside the comments if( checkbomb() )startbomb(); //end of codes } Fixed code: void OnNewGameState(GameState gs) { Invoke(new Action(() => { //Your Code is inside the comments if( checkbomb() )startbomb(); //end of codes })); }
So just copy all your "OnGameStateUpdate" codes to the block: Invoke(new Action(() => { //code here }));