I have the class PlayerController
public class PlayerController : MonoBehaviour
{
bool isMoveable;
public void Init()
{
isMoveable = false;
}
void Update()
{
...
}
private void FixedUpdate()
{
if (isMoveable)
{
MovePlayer();
}
}
public void EnableMovement()
{
isMoveable = true;
}
void MovePlayer()
{
}
}
I have class GameMaster
public the class GameMaster : MonoBehaviour
{
PlayerController playerController;
private void Start()
{
playerController.Init();
}
public void StartGame()
{
playerController.EnableMovement();
uiManager.OnGameStarted();
}
}
and I'm trying to start the game by clicking a button that activates StartGame()
. But MovePlayer()
never got called, but if I print Debug.Log(isMoveable)
in EnableMovement, I get True
.
I have tried to change isMoveable
by int and enum but that didn't help.