Download

Adding a mesh component in c++, then assigning the mesh manually in BP - tips?

Hey gang,
I haven’t been able to google fu this so far: I am building a c++ spawn class that has a static mesh component assigned via c++ in a way that I can then allow the end user to specify a mesh?
I end up with MeshName(inherited) suffix in the component list and the object is not editable. Am I thinking about this the wrong way?

Thanks!

Do you create the component in the constructor as a default subobject?
You need to assign it to a property declared as follows:


UPROPERTY(VisibleAnywhere, BlueprintReadOnly) 
UStaticMeshComponent* MeshComp;

It should then be editable.

Thank you very much, I’ll give it a go!

Ah yes that worked, thank you so much!