I have a actor component it has one enum variable named CurrentAction. i dont directly use any value form that variable in the logic. and i want to use this component on both ai and player. what i hope to achieve is when i add the component in player i can change the enum type of currentAction variable to E_PlayerActions. and when i add the component in enemy i can change the enum type of that same variable to E_EnemyActions. is this possible.
There’s no plausible way to change a variable’s class at runtime, at least not in Blueprints. What are some examples of where you’re using this variable? It’s possible that you could simply put all the actions in one Enum or store the two Enums directly in the player/enemy classes instead of in your actor component.
I dont want to change them at runtime. just want to use different enums for player and ai.
What my component does is its basically a state manager component. when i change the value of enum it call two event dispatchers one for the previous enums which is ended and one for new value which is started and i use these event dispatchers in player and ai.
And yes if there is not way to do this i will simply merge all values into one enum. It just wont be cleaner approach.
merging them is probably the cleaner way, an alternative is to use GameplayTags.
otherwise what you can do is convert the enum to string or bytes and compare that way but i feel this is more prone to error