# Argument of type "UStaticMeshComponent " is incompatible with parameter of type "UStaticMesh "

**URL:** <https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [September 18, 2020, 10:48am UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537 "2020-09-18T10:48:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![william2013987](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@william2013987](https://forums.unrealengine.com/u/william2013987)\
**Post date:** [September 18, 2020, 10:48am UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/1 "2020-09-18T10:48:44Z")

</div>

Why I get this error ?

> Blockquote

argument of type “UStaticMeshComponent \*” is incompatible with parameter of type “UStaticMesh \*”

```
#include "Components/StaticMeshComponent.h"
    static ConstructorHelpers::FObjectFinder<UStaticMeshComponent> CubeMesh(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'"));
    
    	if (CubeMesh.Object) {
    		BombMesh->SetStaticMesh(CubeMesh.Object);
    	}

```

---

<div class="post-metadata">

**Author:** ![GEODVS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GEODVS](https://forums.unrealengine.com/u/GEODVS)\
**Post date:** [September 18, 2020, 12:41pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/2 "2020-09-18T12:41:07Z")

</div>

Hi,

Please try this:

```
    #include "Engine/StaticMesh.h"
    #include "UObject/ConstructorHelpers.h"

    static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeMesh(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'"));
```

---

<div class="post-metadata">

**Author:** ![william2013987](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@william2013987](https://forums.unrealengine.com/u/william2013987)\
**Post date:** [September 18, 2020, 12:45pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/3 "2020-09-18T12:45:54Z")

</div>

did not work, thanks

---

<div class="post-metadata">

**Author:** ![GEODVS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GEODVS](https://forums.unrealengine.com/u/GEODVS)\
**Post date:** [September 18, 2020, 1:00pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/4 "2020-09-18T13:00:07Z")

</div>

if (CubeMesh.Succeeded()) {  
BombMesh-\>SetStaticMesh(CubeMesh.Object);  
}

---

<div class="post-metadata">

**Author:** ![william2013987](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@william2013987](https://forums.unrealengine.com/u/william2013987)\
**Post date:** [September 18, 2020, 1:02pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/5 "2020-09-18T13:02:45Z")

</div>

compiler does not like setstaticmesh it say it is not comptatible with staticmeshcomponent !!

---

<div class="post-metadata">

**Author:** ![GEODVS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GEODVS](https://forums.unrealengine.com/u/GEODVS)\
**Post date:** [September 18, 2020, 1:11pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/6 "2020-09-18T13:11:56Z")

</div>

/\*\* Put in header file \*/

```
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Bomb", meta = (AllowPrivateAccess = "true"))
class UStaticMeshComponent* BombMesh;

// Add to your Cpp
// Component Headers
#include "Components/StaticMeshComponent.h"

// Engine Headers
#include "Engine/StaticMesh.h"

// Constructor Helper
#include "UObject/ConstructorHelpers.h"

// Add to your constructor
 BombMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(" BombMesh"));

static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeMesh(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'"));
if (CubeMesh.Succeeded()) {
          BombMesh->SetStaticMesh(CubeMesh.Object);
      }
```

---

<div class="post-metadata">

**Author:** ![william2013987](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@william2013987](https://forums.unrealengine.com/u/william2013987)\
**Post date:** [September 18, 2020, 1:36pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/7 "2020-09-18T13:36:28Z")

</div>

many thanks

---

<div class="post-metadata">

**Author:** ![GEODVS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GEODVS](https://forums.unrealengine.com/u/GEODVS)\
**Post date:** [September 18, 2020, 1:58pm UTC](https://forums.unrealengine.com/t/argument-of-type-ustaticmeshcomponent-is-incompatible-with-parameter-of-type-ustaticmesh/471537/8 "2020-09-18T13:58:45Z")

</div>

I think you will need to accept the answer for it it be marked as resolved.
