How to do i use interface here


I’m trying to interface so far no issue but heard ppl saying casting can also avoid but i just cant figured it how

1st Screen shot from Animation blueprint

Thanks for help

What are you actually asking about? You say you want to use an interface, but then you say you’re already using an interface and it works fine (even though we cannot see it).

ppl saying casting can also avoid

Any chance you could clarify this one, too?

I believe the issue is they want to cast to the player controller and they need to figure out how to so they can basically just use the inputs into the animations most likly. However i don’t think this is possible to my knowledge. If this is not what your saying then as the previous post inquires Please tell us more.

Sorry my bad there
What I meant to say that I have using interface in line trace and interact event
But I want to use it for casting as shown 1st screenshot (In animation blueprint)

Yes you got it right sorry for my bad English
You said, it’s not possible, is there any way around without casting to my player blueprint?

I do not understand the issue. What exactly is stopping you from calling an interface function? You know how to call it when tracing, this would be identical.

I want to use it for casting

What does it mean that you want to use interface for casting? You either use an interface (which also casts but you can’t see it in BP - it’s hidden from you), or you cast yourself.

casting is fine in certain places, for instance an Animation will only have one type of owner and that owner will be loaded into memory. So cast away there.

That said, dont do it on Update, do it once on start, save the Ref like you have and use the Ref on update.

1 Like

Save the reference on the Initialize Animation event then do a Validated get on the Update. Notice that you don’t need a reference to your specific Pawn if you only need Actor or Pawn variables.

Also make an event to update the reference if you’re going to possess more than one pawn and keep the Animation Blueprint. You will need to call this event manually

Im not sure if this might be what you need if the one above me is not what you need but if you want to access the animations within the blueprint you can get the animation instance like such.

Make sure you know exactly what you need as it helps up others diagnose the issue better!