So I made a class in C++ fo function as my hitbox in game. I wanted additional functionality on it.
Here’s the code. It’s very basic:
/**
*
*/
UCLASS(BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent), Category="Combat Meta")
class TOSH_PROTOTYPE_API UCombatBoxComponent : public UBoxComponent
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FGameplayTag Tag;
};
UCLASS(BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent), Category="Combat Meta")
class TOSH_PROTOTYPE_API UCombatHitboxComponent : public UCombatBoxComponent
{
GENERATED_BODY()
public:
UCombatHitboxComponent();
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FAttackProperties AttackPropertiesHolder;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
TMap<const ACombatCharacterBase*, int> HitActors;
virtual void SetCollisionEnabled(ECollisionEnabled::Type NewType) override;
// Register a hit to an actor. Returns the number of hits the actor has registered.
UFUNCTION(BlueprintCallable)
int RegisterHit(const ACombatCharacterBase* CharPtr);
UFUNCTION(BlueprintCallable)
int GetHitCount(const ACombatCharacterBase* CharPtr);
UFUNCTION(BlueprintCallable)
void ClearHitRegisters();
};
Initially I added it to my actor and everything was fine, but somewhere along the line I recompiled my project and now it crashes every c++ compile through the editor.
Additionally, the inherited component seems to have lost it’s transform details, save for it’s scale. Setting it’s Box Extent data doesn’t not persist between builds. I can oly delete it and add a new class of the same type, but it just ends up happening again on next build.
Also, somehow deleting it caused a different component of the same class to be deleted form a different blueprint class. It had completely different properties and didn’t show the above issues.