Download

Arrays of Structs, error

Hi there, I’m new to C++ and I got an error immediately.
I have an Interface, which returns an array of a certain struct.

I have a Volume, which should add this array of structs when entering and removing it when leaving.


void AEnvironmentVolume::ActorEnteredVolume(AActor* Other)
{
	Super::ActorEnteredVolume(Other);
	IWindAffectable* windAffectable = Cast<IWindAffectable>(Other);
	if (windAffectable == nullptr)
	{
		return;
	}
	else 
	{
		windStructs.Append(windAffectable->getComponentsAffectedByWind());
	}
}

void AEnvironmentVolume::ActorLeavingVolume(AActor* Other)
{
	Super::ActorLeavingVolume(Other);
	IWindAffectable* windAffectable = Cast<IWindAffectable>(Other);
	if (windAffectable == nullptr)
	{
		return;
	}
	else
	{
		TArray<FWindAffectableStruct> structs = windAffectable->getComponentsAffectedByWind();
		for (FWindAffectableStruct s : structs)
		{
			windStructs.Remove(s);
		}
	}
}

The signature of the Interface Function looks like this:


UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Wind")
		TArray<FWindAffectableStruct> getComponentsAffectedByWind();

I get this error, though:

Edit: Solved.

I needed to overload the == operator:

https://answers.unrealengine.com/questions/81444/tarray-find-no-operator-found-or-suitable-conversi.html