Announcement

Collapse
No announcement yet.

How To Get Character Variables In A HUD Class

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

    How To Get Character Variables In A HUD Class

    My custom character class ALifeCharacter has a variable (array) called ItemInventory that's full of his inventory. In my custom AHUD class, AInventoryHUD, I need to get this variable and use it to foreach a bunch of Hitboxes onto the screen. I can do the latter, but I have no idea how to get the variable. Should be easy for some of you.

    Thanks!

    **Edit
    I figured it out. In case anyone wants to know in the future, you can do it like so:

    Code:
    ALifeCharacter* MyCharacter = Cast<ALifeCharacter>(GetOwningPawn());
    		
    	TArray<class AInventory*> MyInventory = MyCharacter->GetCurrentInventory();
    Last edited by AllenGingrich; 10-24-2014, 10:19 AM.

    #2
    One tip: Check if the Pointer is not NULL before using it, see my thread:
    https://forums.unrealengine.com/show...ning-2-players

    Comment

    Working...
    X