Download

How do i cast character class ai inside umg?

the reason i want to cast this is because if i do the save funcion inside the game aka in the medicai bluepring because i have so much ais the fps will chug really hard

so i was like why not do it on save and exit to main menu button? well guess what it always fails the node never casts even if i get no error

please help ive been trying to do this for 3 days


help-im-alive.png

Try switching the cast to medicai to an Impure Cast. Right click on it and it should be on the popup menu.

i tried that but no matter what i cant seem to find what to plug in the object to make the cast not fail

Widgets don’t have any idea which MedicAI you are referring to unless if you save a reference to the AI Pawn within the widget.

GetAiController expects a Pawn input or to be called on the AiController which your Widget isn’t so it will always fail.

GetParentActor is something completely different that is only used on ChildActorComponents.

So you need to have a reference to the MedicAi Pawn. I recommend you learn more about Blueprint communication since that is an essential skill otherwise you will quickly get stuck.