I have Interface:
UINTERFACE(MinimalAPI)
class UWeaponSelectorInterface : public UInterface
{
GENERATED_BODY()
};
class WEAPONS_API IWeaponSelectorInterface
{
GENERATED_BODY()
public:
virtual bool SetSelectedWeapon(const EWeapon Weapon) = 0;
virtual EWeapon GetSelectedWeapon() = 0;
virtual FWeaponDelegate* GetSelectedWeaponChangedDelegate() = 0;
};
Also I have my PlayerState class:
class MY_API AMyPlayerState : public APlayerState, public IWeaponSelectorInterface
When I try to cast MyPlayerState to IWeaponSelectorInterface
const auto PlayerState = GetOwningPlayerState();
const auto WeaponSelector = Cast<IWeaponSelectorInterface>(PlayerState);
I’m getting an error:
unresolved external symbol "private: static class UClass * __cdecl UWeaponCollectorInterface::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@UWeaponCollectorInterface@@CAPEAVUClass@@XZ) referenced in function "public: enum ESlateVisibility __cdecl UCrosshairWidget::IsWeaponEnabled(enum EWeapon)const " (?IsWeaponEnabled@UCrosshairWidget@@QEBA?AW4ESlateVisibility@@W4EWeapon@@@Z)
If I use the same interface in another (not PlayerState) classes then it works fine.
Why can’t I cast PlayerState to an Interface?