Asset reference in a child blueprint class?

I have a TSubObject AssetMesh in my ItemObject class:


But I can’t choose my asset reference in my blueprint child class:


Why ?


Hello herotom99,

You can try this:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Item)
class UStaticMesh *StaticMesh;

Hope this helps.

Hey herotom99-

If you are trying to add a static mesh component that you can assign a specific static mesh to then your UPROPERTY would be a UStaticMeshComponent* StaticMesh. In the source file you would set up the component inside the constructor with:

StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("SomeText"));

A blueprint based off this class will have an inherited Static mesh component as a part of the BP by default.


Yes but I want to have a blueprint item. In property, I set my mesh and then I can drag and drop the blueprint class.
But the Default mesh (in property) is not here :confused: I have to call him in the BeginPlay() function !

Yes but it doesn’t work because I have to use a pointer to show or not my mesh

If a set MeshPtr = NULL I loose my mesh :confused:
So I can’t save the mesh in the default mesh

So you are trying to set the mesh itself in code? To do so you need to use constructor helpers to get a reference to the static mesh in the content browser. This can be done using the following code in the constructor:

ConstructorHelper::Fobjectfinder [NAME](TEXT(“[Editor Reference Location]”));

You can get the reference location by right clicking on the asset in the content browser and choosing Copy Reference and pasting it between the pair of quotes. With this in place you can then create the static mesh component and set the specific mesh to it as such:

UStaticMesh* MeshToBeSet = [NAME].Object;

MeshPtr = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
MeshPtr = SetStaticMesh( MeshToBeSet);

But I don’t have the reference of my mesh !
I have :

  • 1 mesh pointer (the default mesh of my class, but it can point Null ( to PickedUp Item) or point point the mesh (dropItem))
  • 1 mesh of my item (set in property in my child blueprint class)

I’m not sure I understand what you’re trying to accomplish. Could you post the code for your class and explain exactly what you’re attempting to do? With more information it will be easier for me to help with this problem.

First, here is the code of my ItemObject class

Here my class in C++


Now,with my code, I create a Child Blueprint Class (an object) of my c++ class

And in my child class I want to select the mesh of my object


But when I drag and drop my object there is no mesh !

oups I have create another answer …
I think that the problem is that the object is initilize before property.

For the mesh to show up in the editor as you’r expecting you would need to set the mesh inside the StaticMeshComponent in the editor or by supplying the path reference to the mesh in a ConstructorHelpers::FObjectFinder call and use the to set the mesh in the class.

As you pointed out, if you set your Static Mesh pointer in the editor and then call SetStaticMesh() in the BeginPlay() function the mesh will appear when playing. If you would like to go this route then it may be helpful for placing objects to add a billboard component so that you have a visual representation of where the actor is.


The Billbloard component will be hide when the game begin ?
This is not very practical :confused: I can’t show the mesh in my editor before launching ?

Yes, the billboard will be hidden in game. You can show the mesh in the editor by doing one of two things as stated in my answer. You can either set the static mesh property inside the static mesh component or you can provide the path to the static mesh and use a combination of FObjectFinder and SetStaticMesh calles to set the mesh in the code.

Ok so its impossible to change the mesh in editor AND show it in the editor.
Maybe I can set my “default” mesh in the editor and when I restart the editor I can see it ?

If you need the static mesh to show in the editor then the best option would be to use the static mesh component. Setting the Static Mesh property of the component will show / update in the editor if changed.

Yes but when i use a static mesh component I can make a pointer …
So why we can’t use property before initilize the object !?
I just want to create different item with the same class …