I have an auto load script set up on Node2D, which is the root node, but I can't get anything to work while trying to reference a global variable.
public class GameManager : Node2D // [ Global Variable ]
{
public int currentDir = 1;
}
---------------------------------------------------------------------------------------
public class Player : KinematicBody2D // [ Player Node ]
{
var gameManager = GetNode<GameManager>("/root/GameManager");
gameManager.currentDir = 1;
}
---------------------------------------------------------------------------------------
There's more code for the player but it's not relevant
I also get this error message for trying to use the global variable -
Invalid token '=' in class, record, struct, or interface member declaration
