Announcement

Collapse
No announcement yet.

Convert enum to uint8

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Convert enum to uint8

    Hello. I have an enum class ECustomMovements:
    Code:
    UENUM(BlueprintType)
    enum class ECustomMovements : uint8 {
        GRAPPLING   = 0            UMETA(DisplayName = "Grappling"),
        OTHER       = 255          UMETA(DisplayName = "Other")
    };

    What I am trying to do is set my movement mode to a custom movement mode, whose second parameter takes a uint8 to denote which custom movement mode I'm switching to:
    Code:
    Player->GetFPCharacterMovement()->SetMovementMode(
        EMovementMode::MOVE_Custom, ECustomMovements::GRAPPLING
    );
    Whenever I try this, I get "cannot convert argument 2 from 'ECustomMovements' to 'uint8'".

    I vaguely remember this working fine about half a year ago. Am I doing something wrong? I want to be able to use the enum in place of a uint8 since this will be used across many classes.

    #2
    uint8 byte = (uint8)ECustomMovements::GRAPPLING;

    Then use that "byte" var instead.
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      Originally posted by BrUnO XaVIeR View Post
      uint8 byte = (uint8)ECustomMovements::GRAPPLING;

      Then use that "byte" var instead.
      I thought I tried this, but apparently not. Thanks!

      Comment

      Working...
      X