Search code examples
unity-game-engineuser-inputenum-flags

Enum Flags values reset on function call, UNITY


I'm trying to implement a simple switch between the control of 2 gameobjects in unity. Said switch can only happen when the entity you're switching from is grounded.

Base Flags values

The issue is that the gameobject's flags apparently get reset to their default values whenever I press the switch key, and because the object's spawning position is airborne, the switch can never happen.

Game launched in editor values

InputSwitch Function

Values at the time of the input

I'm completely lost as to why the flags get reset, nothing in my code tells me that it would do that, and even after trying to print some values at different points of the process, everything seems to be in order until the switch function gets called, and said function doesn't call upon all these other values at all excepy for a check on the Grounded flag.

Anyone knows what could be happening?


Solution

  • It was an issue o mapping the object instead of the prefab to the component. bug dumb. fixed now.