I have an Abstract class that i use for interaction stuff. On it, are 2 different collision components and 1 root scene component for hierarchy purposes:
UCLASS(Abstract)
class ECDD_API AInteractiveActor : public AActor, public IInteractiveInterface
{
GENERATED_BODY()
public:
AInteractiveActor()
{
SceneComponent = CreateDefaultSubobject<USceneComponent>(FName("AInteractiveActor_SceneComponent"));
SetRootComponent(SceneComponent);
// InteractionAreaCollisionComponent
InteractionAreaCollisionComponent = CreateDefaultSubobject<UCapsuleComponent>(FName("AInteractiveActor_InteractionAreaCollisionComponent"));
InteractionAreaCollisionComponent->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
InteractionAreaCollisionComponent->SetCollisionResponseToChannel(ECollisionChannel::ECC_Visibility, ECollisionResponse::ECR_Block);
InteractionAreaCollisionComponent->SetCanEverAffectNavigation(false);
InteractionAreaCollisionComponent->SetupAttachment(SceneComponent);
// CollisionComponent
CollisionComponent = CreateDefaultSubobject<UCapsuleComponent>(FName("AInteractiveActor_CollisionComponent"));
CollisionComponent->SetCanEverAffectNavigation(false);
CollisionComponent->SetupAttachment(SceneComponent);
CollisionComponent->ShapeColor = FColor::Green;
}
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Custom")
USceneComponent* SceneComponent;
// When play is in area of collision component, interactions can happen
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Custom")
UCapsuleComponent* InteractionAreaCollisionComponent;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Custom")
UCapsuleComponent* CollisionComponent;
}
Here is a class that inherits from the Abstract class. It doesn’t do a lot, but I have based my blueprint off of it.
UCLASS()
class ECDD_API ALoadLevelActor : public AInteractiveActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ALoadLevelActor()
{
}
};
My LoadLevelActor blueprint has the correct hierarchy, but notice how the collisioncomponent is empty in the details panel:
Also notice that when i drag an instance into my level, the hierarchy has completely gone and yet you can see the 2 highlighted components?
It’s possible that I renamed the scene component property after creating the blueprint, but would have expected it to update correctly. I have roughly 100 instances of this that are all wrecked. Is there anything you can think of that i can do to try and mitigate this weirdness?