A "state" field in a NetworkBehaviour component seems to get some unknown value

Pretty simple… I have a state field in my Game class that extends NetworkBehaviour. state is an enum of State.

private NetworkVariable<State> state = new(State.WaitingForPlayers);

In a game manager class, I was checking to see if the game is in a certain state via

if (this.game.GetState() == Game.State.WaitingForPlayers)

Which calls this in Game

public State GetState()
  {
    return this.state.Value;
  }

This is always returning 5, which is out of bounds for my enum. I looked everywhere and I cannot find a place where I set my state to 5 etc. So I renamed state to gameState and now it works as expected.

Known bug? Seems like a lot of people would have a state field in their classes…

check any warning messages particularly anything about the field requiring the ‚new‘ keyword

C# has properties, expression methods, and this is superfluous. So:

public State State => state.Value;

Yep… no warnings etc. Really bizarre.