UStaticMeshComponent Transform Hidden in Blueprint

When you create a Static Mesh as a component underneath another Scene Component in blueprint, you are able to see and edit its location, rotation and scale. However, when I do the equivalent in C++ by creating a UStaticMeshComponent, I am unable to see or edit its location and rotation. Why is this?

1 Like

Components need the UPROPERTY specified VisibleDefaultsOnly or a variation of it in order for the details panel to be shown in a blueprints derived class.

This is how I typically write my components, however you can look through the Character.h file for more examples

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = "Components")
class UStaticMeshComponent* MeshComponent = nullptr;

Thanks for the response :grinning: but, for whatever reason, this didn’t work for me. The location and rotation are always hidden in in the BP no matter the UPROPERTY specifiers :roll_eyes:

The components are marked as public and are initialized in the class constructor using CreateDefaultSubobject(). They work normally in the BP in every way except for the location and rotation.

Declaration of the variables in the .h file:


UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = Components)
	UStaticMeshComponent* RootComponentMesh;

UPROPERTY(VisibleDefaultsOnly, BlueprintReadWrite, Category = Components)
	UStaticMeshComponent* ChildMesh;

Initialization in the class constructor:

RootComponentMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Root Component Mesh"));

RootComponent = RootComponentMesh;

ChildMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Child Component Mesh"));

And the result in a blueprint inheriting from this class:

Still no location or rotation… Weird.

I’ve found that I can use sockets as a workaround, so I’m not stuck thankfully, but UE makes things confusing…

1 Like

Minor gripe: you should be using SetRootComponent() instead of accessing the RootComponent directly.

Secondly, I think your issue will be solved by calling an attachment - You don’t appear to have one after you initialize your child mesh:

1 Like

Thank you very much :smiley: