// Inherited via IInteract
void Interact(UPrimitiveComponent* comp) override;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door")
UPrimitiveComponent* comp;
You code is actually correct and the error you are getting is technically not an error but a warning. However, it is good practice to have your code compile without warnings so Unreal has the compiler configured to treat warnings as errors so you are forced to deal with them. The warning is that the “item” variable you use as function parameter hides the class member “item” because it has the same name. Just name the function parameter something else like “otherItem”. It is also common for overloaded comparison operators to simply call the identifier on the right “rhs”.
https://forums.unrealengine.com/t/c-unreal-engine-4-error-c4458-please-help/263862/2
Leave a Reply