Im fairly new to visual scripting and Blueprints. I wanted to try this out but couldn’t find much information on specific topics that I have doubts about.
First iteration
Below is a function from a function library that returns a speed_float based on the speed_type_enum. The enum has three constant types, while the other two are player-specific, so they needed to be global variables stored in the Game Instance.
To access the Game Instance, I had to use a Cast Node every time I needed to retrieve a different speed variable. This was because of the flow of execution pins from the Switch to the Return node.
Second iteration
I thought I could use a local variable to store the Game Instance, but it could only be assigned before the Switch Node. This is problematic since I need the Game Instance only twice out of the five cases.
So, I implemented the following approach:
Im not sure which approach is more efficient. Perhaps I need to rethink the entire speed-type functionality.
For context, the Speed_Type_Enum is stored in the base BP_Character, which is inherited by both BP_Player and BP_Enemy. My initial thought was that it would make the Behavior Tree easier to manage if I used an enum instead of float values to make decisions.

