Hi, kids.
I’m trying to translate my Gameplay Abilities to C++ and I’m having a LOT of problems, but this one is actually giving me quite a headache.
So… apparently non-const pointers to const can be a UPROPERTY
and act as a regular property. You can modify the value and call functions that take non-const parameters and pass those.
So I can use the WaitGameplayEvent
task and call and interface function on its Payload.Target
with no issues whatsoever.
When I try to implement the same logic in C++, however, when I bind a handler function to the delegate EventReceived
of the UAbilityTask_WaitGameplayEvent
task inside my own Gameplay Ability, the variable Payload.Target
I get is of type const AActor*
and if I try to call my interface function on it, the compilation error void IMyInterface::Execute_interfaceFunction(UObject *,AActor *)': cannot convert argument 1 from 'const AActor *' to 'UObject *
pops up.
I tried casting it ahed of the function call, but it still does not work.
The error 'initializing': cannot convert from 'const T *' to 'UObject *'
and the IDE tells me a value of type "const UObject*" cannot be used to initialize an entity of type "UObject*"
.
I’m guessing the desired behaviour is the one I see in C++? Probably for async reasons mumbo-jumbo or something else I don’t get… am I right?
If I’m not, how do I tackle this? If I am, what’s the best way to work around this?