Hitting a breakpoint with the following function system, I'm trying to return a protected variable of type 'enum' via a public function, and then do a comparison to see if it equals another enum. How can I make the following code work properly?
BZGame_Weapon.h
BZGame_Weapon.cpp
That sets the variable of this specific class, but I want to see if the variable matches another one in the following class, to see if I can spawn it like so:
BZGame_GameObjectComponent.cpp
BZGame_Weapon.h
Code:
UFUNCTION(BlueprintPure, Category = "Weapon") EBZGame_WeaponClass GetWeaponClass() const; protected: /* Weapon Class - Set By Code Automatically. */ UPROPERTY(VisibleDefaultsOnly, Category = "Weapon") EBZGame_WeaponClass WeaponClass;
Code:
ABZGame_Weapon::ABZGame_Weapon(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { WeaponClass = EBZGame_WeaponClass::EWC_None; } EBZGame_WeaponClass ABZGame_Weapon::GetWeaponClass() const { return WeaponClass; }
BZGame_GameObjectComponent.cpp
Code:
ABZGame_Weapon* TestWeapon = Cast<ABZGame_Weapon>(HardPoints[i].DefaultWeapon); if (TestWeapon->GetWeaponClass() == HardPoints[i].HardpointClass) { //Do Stuff
Comment