Hi,
I have this C++ class (extending from AActor), which has been extended in a blueprint class.
I have a UboxComponent that I want to use as an attribute for my class (in my cpp code) . My problem is that : The uboxcomponent details simply won’t show up in my blueprint editor.
Here is how I am creating my properties :
In the actor C++ class, in the .h file, I’ve got :
public :
…
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshComponent* Mesh;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Helicopter, meta = (AllowPrivateAccess = "true"))
UBoxComponent* Box;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
USceneComponent* Root;
…
In the actor C++ class, in the .cpp file, I’ve got
ABridgeSwitch::ABridgeSwitch()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don’t need it.
PrimaryActorTick.bCanEverTick = true;
Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
RootComponent = Root;
Box = CreateDefaultSubobject<UBoxComponent>(TEXT("Box"));
Box->SetupAttachment(RootComponent);
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
Mesh->SetupAttachment(RootComponent);
…
}
Note that if I add a box manually in the blueprint editor, I can clearly see its details. However, I want to have access to this variable in c++, and be able to create it in my c++ class constructor.
Also, note that this actor is simply composed of :
- a root component (scenecomponent) that doesnt need to collide to anything or else, it just needs to be there to be the parent of other components
- a mesh (simple cube) that blocks collisions with other actors
- a collision box (UBoxComponent) which is larger than the mesh that allows overlapping with other actors.
Thanks for the help.