I had a couple of methods declared in an actor class as follows:
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = Setup)
FVector GetBoatForwardVector() const;
This worked and could be implemented in a derived BP.
However, when I moved this method into an interface, it would not compile :
UINTERFACE()
class UBuoyantObjectInterface : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class IBuoyantObjectInterface
{
GENERATED_IINTERFACE_BODY()
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = Setup)
FVector GetBoatForwardVector() const;
};
It causes the following error:
cannot convert 'this' pointer from 'const UObject' to 'UObject &'
This is resolved by removing the const specifier on the method. How can I keep the const specifier and have this method declared in the interface?