I am creating an actor with a static mesh component. I create a blueprint with this actor for the parent. I can set the default value for the mesh in the blueprint. However, while the mesh will be instanced and render, it will not be accessible by variable name.
I declare the property:
UPROPERTY(Category = Pawn, VisibleAnywhere, BlueprintReadOnly)
TSubobjectPtr<class UStaticMeshComponent> MeshComponent;
and initialize it:
MeshComponent = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("MeshComponent"));
RootComponent = MeshComponent;
I can go to the component view and set the default value for the static mesh on the component.
If I get the MeshComponent variable in the blueprint graph, the variable is not valid. If I get the root component, voila! Magical access! And depending on variable I have not figured out yet, I may or may not actually see the mesh rendered.
My best guess is that the derived blueprint is declaring a property of the same name as the native component, and setting the default on that. When I do the look up by name, I presume I am getting the native version, which is not initialized for some reason. The derived class version I am guessing is available through the root component access. It would be nice to get that confirmed though.
I’d really like to know how I am supposed to allow blueprints to specify characteristic like mesh for C++ to use. I have a bunch of behavior in C++ that I’d like to reuse, but swap out the art and other parameters. I do however need to access default values for the parameters and I’d like to be able to get at the mesh. This seemed like a reasonable pattern to me, but I am obviously not grokking the right way to do it.