Godot Version
4.4.1
Question
So I have a class Expander0
which is a scene of UI nodes used to open a dropdown panel when pressed. One of the variables in the class is Direction
, which is exported; I have a test instance of Expander0
in my main scene with its Direction
set to “0Up” in the inspector. Another variable in the class is DirectionOpposite
, which is intended to be a String
of the opposite direction, corresponding to “1Down” in my directional system if Direction
is “0Up”; DirectionOpposite
is determined at ready depending on the value of Direction
, being assigned to the return of function Get_DirectionOpposite
via the function’s match statement.
The class also has static var CurInst
, which keeps track of the most recent or “active” instance of the class; since I only have one instance of Expander0
in the main scene, it is equivalent to CurInst
in this situation.
However, the match statement is returning false on all of its conditions even though the Direction
of this instance of Expander0
is set to “0Up”, and it’s clear that this value of CurInst.Direction
is known by the code when Get_DirectionOpposite
is called (as the test print(CurInst.Direction);
returns “0Up” as it should); thus I would expect the match statement to return “1Down” here, but it is returning Nil and thus an error is thrown since the line DirectionOpposite = Get_DirectionOpposite();
is assigning DirectionOpposite
to this Nil value instead of “1Down” like it should be.