How do I create a Mesh Variable in C++?

I believe this will help, video 3 details static meshes, but i’d recommend watching them all.
https://www.youtube.com/watch?v=ZPn4N3ckP8I

Hello :slight_smile:

I want to know how I can make a Mesh “Variable” in C++
In Blueprints you can make a new Variable and select “StaticMesh” as type.

How do I do that in C++? I tried “TSubobjectPtr” (because that is the only thing that I could think off), but it doesn’t work. Because it needs to be BP callable, but Subobjects cannot be callable.

I am very new to Coding (especially UE4 code) Please help me :slight_smile:

She is creating a Static Mesh as a Subobject. As I tried…
But I want it as a variable.

In here: No weapon Mesh

http://puu.sh/9MO2Y/a2d3bff3f8.jpg

Here: Weapon Mesh Variable

http://puu.sh/9MO5j/6ad547178f.png

That is what I need, not a Subobject :slight_smile:

But I want to do it in C++

Apologies, all you need to do to get a static mesh variable, perhaps to change the mesh of a static mesh subobject at runtime? I do the following:

UPROPERTY(EditAnywhere, Category = "Weapons", BlueprintReadWrite)
    	UStaticMesh* TestStaticMesh;

Ensure you have ‘Show Inherited Variables’ checked in the My Blueprint panel.

Please correct me if this is wrong :slight_smile:

1 Like

Nice!
Thank you very much!
Works just as I need it :slight_smile: