Updating HUD with C++

I am currently experimenting with UE4. I have mostly been working with C# and java in the past, so some elements of C++ are foreign to me, such as the “->” notation. So I have made a recoil system and some basic HUD elements, but I have problems getting access to the HUD’s pointer in the character object. What would be the best way of doing this? Thanks.

[FONT=Comic Sans MS]Welcome to the forums Akblabla!

Here’s one route you could go, remember to always check your pointers!



//Inside a Character or Pawn Class
AHUD* GetHUD()
{
  if(!IsLocallyControlled() || !PlayerState) //we only want locally controlled and controlled by player, not AI
 {
   return nullptr;
 }

   APlayerController* PC = Cast<APlayerController>(GetController());
   if(!PC)
  {
    return nullptr;
  }

  return PC->GetHUD();
}


Enjoy!

Rama

Thanks, worked perfectly.