# How do I get an Actor's static mesh?

**URL:** <https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048>\
**Category:** Asset Creation\
**Tags:** aactor, unreal-engine, CPP, question\
**Created:** [November 3, 2014, 5:13pm UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048 "2014-11-03T17:13:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c6c5dc0d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c6c5dc0d](https://forums.unrealengine.com/u/anonymous_user_c6c5dc0d)\
**Post date:** [November 3, 2014, 5:13pm UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/1 "2014-11-03T17:13:33Z")

</div>

I have an AActor \* type. How do I get it’s static mesh?

When I look at the Actor in the editor, I can see in the root component it has a Static Mesh set. I can see it in the content browser.

However, in C++, I can’t seem to be able to access that Static Mesh? There seems no way to get to it.

I had tried casting my actor from AActor \* to AStaticMeshActor \* but I keep getting a NULL back.

```
AActor * rootComponent = GetOwner();
AStaticMeshActor *	staticMesh = Cast<AStaticMeshActor>(rootComponent);

```

It seems like a simple thing to do, how do you access the static mesh from an actor?

---

<div class="post-metadata">

**Author:** ![Chris\_Ledwith](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Ledwith](https://forums.unrealengine.com/u/Chris_Ledwith)\
**Post date:** [November 3, 2014, 5:59pm UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/2 "2014-11-03T17:59:47Z")

</div>

Try this:

```
TArray<UStaticMeshComponent*> Components;
Actor->GetComponents<UStaticMeshComponent>(Components);
for( int32 i=0; i<Components.Num(); i++ )
{
    UStaticMeshComponent* StaticMeshComponent = Components[i];
    UStaticMesh* StaticMesh = StaticMeshComponent->StaticMesh;
}

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c6c5dc0d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c6c5dc0d](https://forums.unrealengine.com/u/anonymous_user_c6c5dc0d)\
**Post date:** [November 3, 2014, 6:37pm UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/3 "2014-11-03T18:37:03Z")

</div>

Thank you. I am a total UDK newbie and with every answer I learn a bit more about the engine.

---

<div class="post-metadata">

**Author:** ![nopunintendo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nopunintendo](https://forums.unrealengine.com/u/nopunintendo)\
**Post date:** [November 4, 2014, 8:08am UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/4 "2014-11-04T08:08:34Z")

</div>

That’s the spirit!

---

<div class="post-metadata">

**Author:** ![teak421](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/teak421/32/902996_2.png) [@teak421](https://forums.unrealengine.com/u/teak421)\
**Post date:** [November 14, 2017, 4:00am UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/5 "2017-11-14T04:00:13Z")

</div>

Hi. This is like three years from the original answer, but consider using the public function GetStaticMesh() instead of -\>StaticMesh. I got an error. Thanks.

---

<div class="post-metadata">

**Author:** ![darkgaze](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkgaze](https://forums.unrealengine.com/u/darkgaze)\
**Post date:** [August 29, 2018, 10:13am UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/6 "2018-08-29T10:13:22Z")

</div>

Or if you just want to get the ONE static mesh that it has, you can take the first by doing: UActorComponent\* comp = GetComponentByClass(UStaticMeshComponent::StaticClass()); . You would have to use Casting to change UActorComponent to the specific StaticMesh Component you have.

---

<div class="post-metadata">

**Author:** ![One2Three456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@One2Three456](https://forums.unrealengine.com/u/One2Three456)\
**Post date:** [June 13, 2019, 2:50pm UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/7 "2019-06-13T14:50:05Z")

</div>

How do i get the name of the StaticMesh?

---

<div class="post-metadata">

**Author:** ![ClayBudin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ClayBudin](https://forums.unrealengine.com/u/ClayBudin)\
**Post date:** [October 17, 2024, 6:38pm UTC](https://forums.unrealengine.com/t/how-do-i-get-an-actors-static-mesh/298048/8 "2024-10-17T18:38:19Z")

</div>

GetName()
