How to get static mesh from static mesh components [BP]

Hi all,

Does anyone know whether it’s possible to get the static mesh used by a static mesh component through blueprints? Casting doesn’t work and I can’t find “Get Static Mesh”, only “Set Static Mesh”.

Thanks in advance!

WAT?

UCLASS(ClassGroup=(Rendering, Common), hidecategories=(Object,Activation,"Components|Activation"), ShowCategories=(Mobility), editinlinenew, meta=(BlueprintSpawnableComponent))
class ENGINE_API UStaticMeshComponent : public UMeshComponent

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=StaticMesh, ReplicatedUsing=OnRep_StaticMesh)
	class UStaticMesh* StaticMesh;

/** Change the StaticMesh used by this instance. */
	UFUNCTION(BlueprintCallable, Category="Components|StaticMesh")
	virtual bool SetStaticMesh(class UStaticMesh* NewMesh);

Static mesh is accessible from StaticMeshComponent.

Show us what are you casting and how.

I’m using blueprints :wink:

Static mesh is accessible from StaticMeshComponent from BP.

Show us what are you casting and how.

This is from my class that’s a child of actor, Static Mesh Component is inherited

69108-screenshot+from+2015-12-02+22-24-35.png

Well, you can’t cast StaticMeshComponent to StaticMesh, but you can get this static mesh from StaticMeshComponent:

Drag this blue dot from the StaticMeshComponent and type SetStaticMesh/GetStaticMesh in function finder.

Well that was easy, I was just being stupid x)

Shame on you, you should delete this question and re-read documentation.

“We’re sorry, but this question already has some answers that you cannot delete.”
Will reread docs though!

What kind of comment is that? I have the exact same question, do I need to feel shame? Understanding comes in many different ways. Reading the manual is important but without understanding they are just words.

I came with the exact same question. Care to elaborate on what the solution was? I am missing something important to understanding.

1 Like

1 Like

The solution is quite simple, just a bit unintuitive.
All you have to do is cast your StaticMeshComponentReference to a StaticMeshComponent, you can safely turn the cast into a pure cast like I did by right clicking on it too.
image