When trying to build the project the following error pops up:
PlayerInterface.gen.cpp(106): Error C2511 : void IPlayerInterface::Equip(USkeletalMesh *,EEquipmentID,const TArray<UMaterialInterface *,FDefaultAllocator> &): overloaded member function not found in "IPlayerInterface"
UINTERFACE(MinimalAPI, Blueprintable)
class UPlayerInterface : public UInterface
{
GENERATED_BODY()
};
class ODWIRKSRPG_API IPlayerInterface
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category="PlayerInterface | Equipment")
void Equip(USkeletalMesh* EquipmentMesh, TEnumAsByte<EEquipmentID> EquipmentID,
const TArray<UMaterialInterface*>& EquipmentMeshMaterials);
};
I think the way you’re implementing the interface might need adjusting. I’m assuming you want to use this in blueprint too but C++ has no grantees you will do that so it needs the interface function implemented natively too.
Your UFUNCTION should be like this using the BlueprintNativeEvent instead.
In your character header you need to implement the interface using _Implementation. You still have the ability to override your interface in blueprint.
11>MainCharacter.h(167): Error C3668 : AMainCharacter::Equip_Implementation: method with override specifier ‘override’ does not override any base class methods
11>MainCharacter.h(167): Warning C4263 : void AMainCharacter::Equip_Implementation(USkeletalMesh *,TEnumAsByte<EEquipmentID>,const TArray<UMaterialInterface *,FDefaultAllocator> &): member function does not override any virtual member function of the base class
11>MainCharacter.h(253): Warning C4264 : void IPlayerInterface::Equip_Implementation(USkeletalMesh *,EEquipmentID,const TArray<UMaterialInterface *,FDefaultAllocator> &): no available override for virtual member function from base class ‘IPlayerInterface’; function hidden
Gotcha. So tried doing the same thing and it seems like the EEquipmentID enum is creating some problem because without it the C++ compiles just fine even if no implementation exists. It also compiles fine if we don’t use the TEnumAsByte.
This works fine just doing EEquipmentID EquipmentID instead of TEnumAsByte, test it and see if your blueprint is able to set it just fine.