Get Character under actor component

Hi,

I have a Character class with some ActorComponent attach to it, in my component I wana get the player character, or make an create widget.

any idea

Hi,

to get the owner of a component as a character you only need to cast it like this :

ACharacter* ownerCharacter = Cast<ACharacter>(GetOwner());
1 Like

to get the player Character it’s work fine, but my explanation isn’t not great

my component will be able to manage the UI of the game, UI made using UMG, so I need to be able to use CreateWidget function, can I delegate this management outside my character ? and how ?

I’m sorry i misunderstood your question :stuck_out_tongue:

It seems that using UMG in C++ is not recommended by Epic.

I don’t know if you can easily create UMG widgets from C++, but you can easily access your character’s UPROPERTY and UFUNCTION from inside the UMG callbacks