So I was looking at the documentation for CreateDefaultSuboject
FObjectInitializer::CreateDefaultSubobject | Unreal Engine Documentation
And the description for the SubobjectName
property is pretty loose: “name of the new component”.
Ok… does this mean the string I pass into the function is what the editor will display for the component in the details tab?
I made a test, like so:
UCLASS()
class VRTEST2_API AMyPawn : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AMyPawn();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
UPROPERTY(EditAnywhere)
UBoxComponent* aBox;
};
AMyPawn::AMyPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
aBox = CreateDefaultSubobject<UBoxComponent>(TEXT("TheBox"));
}
And was expecting the editor to show this pawn’s component as “TheBox”. But instead it shows the member declaration identifier (aBox):
So what’s the point of this parameter? is it just for search purposes within code? Like, assigning a tag to the object?