Can not cast AnimInstance to Interface

I have the interface shown above defined in C++

I added the interface to Vm13AnimBlueprint I made in the editor. The interface is listed in animblueprint’s “Implemented Interfaces” column. I can also create node events defined in the interface.

However I am unable to call these events from C++. The cast from the AnimInstance to the Interface always fails. The character variable is always NULL. You can see from the debug popup that the AnimInstance is correctly acquired but the cast is failing.

I’ve come back to c++ after a very long time maybe I misunderstood something basic? why is this not working?

ILedgeGrabInterface does not inherit from any class, ULedgeGrabInterface is a UInterface derived class, and your AnimInstance var is an UAnimInstance class… As far as I know, the Cast method works only for related classes, like UVehicleAnimInstance is a UAnimInstance implementation, so you can cast it.

This was a long while back.

It seems my issue was that I added the ULedgeGrabInterface to the AnimInstanceBlueprint in the Editor then tried to cast my base AnimInstance class in c++ which is not going to work.

To get this to work I have to add the interface in c++