[FONT=Arial Black](EDIT: I found the answer. I was using AddUnique when adding structs to the array, so it would need a way to compare and see if it was already existing in the array, therefore the need for the operator.)
USTRUCT(BlueprintType)
struct FPaperSkeletonSkinData
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FName SlotName;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FName NonSpecificName;
class UPaperSkeletonAttachment* Attachment;
FPaperSkeletonSkinData(){}
FPaperSkeletonSkinData(FName slotName, FName nonSpecificName, class UPaperSkeletonAttachment* attachment)
: SlotName(slotName), NonSpecificName(nonSpecificName), Attachment(attachment)
{
}
bool operator==(const FPaperSkeletonSkinData& rightSkin) const;
};
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TArray<FPaperSkeletonSkinData> Attachments;
Above is the Custom Struct that required a “==” operator be set, so that TArray’s.Find function could work properly. My question is, why does this Custom Struct require that, when the other Custom Struct below, which is stored in a TArray aswell, doesn’t require the “==” operator overload even though its almost 2-3 times as complicated.
(NOTE: I’m never actually explicitly using the TArray.Find function, only using for-each loops)
USTRUCT(BlueprintType)
struct FPaperSkeletonAnimationData
{
GENERATED_USTRUCT_BODY()
// Skeleton Data (Owner)
class UPaperSkeletonData* Owner;
// Name of the Animation
UPROPERTY(EditAnywhere)
FName AnimationName;
// Duration of the Animation
UPROPERTY(EditAnywhere)
float Duration;
// Should the animation loop?
UPROPERTY(EditAnywhere)
bool bShouldLoop;
// Timelines/Objects relative to the Animation
UPROPERTY(EditAnywhere)
TArray<FPaperSkeletonTimelineData> Timelines;
FPaperSkeletonAnimationData(){}
FPaperSkeletonAnimationData(class UPaperSkeletonData* owner, FName animationName, float duration, bool shouldLoop, TArray<FPaperSkeletonTimelineData>& timelines)
: Owner(owner), AnimationName(animationName), Duration(duration), bShouldLoop(shouldLoop), Timelines(timelines)
{
}
FPaperSkeletonTimelineData* FindTimeline(FName objectName);
};
// Skeleton Animations
UPROPERTY(EditAnywhere, BlueprintReadOnly)
TArray<FPaperSkeletonAnimationData> Animations;
(AnswerHub Reference - Only Certain Custom Structs Require “==” Operator for TArray’s to work)