# Removing and added static mesh component

**URL:** <https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669>\
**Category:** UI\
**Tags:** staticmeshcomponent, unreal-engine, Widget, UE4, question\
**Created:** [March 22, 2021, 2:40am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669 "2021-03-22T02:40:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 2:40am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/1 "2021-03-22T02:40:04Z")

</div>

Hey there, Im having a real hard time with placing static meshes with a widget menu. Using “set static mesh component” shows my mesh horribly lit I"ll add a picture of how they look. Any way, creating a custom event where I place a the mesh with the “ADD STATIC MESH COMPONENT” and appears OK in runtime. Now I need to remove this added mesh o either replace it with another static mesh component. Im posting a picture of how my event nodes look like.!

---

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 3:11am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/2 "2021-03-22T03:11:34Z")

</div>

just in case I wasnt clear enough, removing the static mesh component needs to be set up as an event triggered by a button. I just cant come across the way to do this

---

<div class="post-metadata">

**Author:** ![GrumbleBunny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GrumbleBunny](https://forums.unrealengine.com/u/GrumbleBunny)\
**Post date:** [March 22, 2021, 7:11am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/3 "2021-03-22T07:11:50Z")

</div>

You can store a reference to the static mesh component in a variable (the Return Value pin on Add Component). Then in another event you can us “Destroy Component” to remove it.

---

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 11:26am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/4 "2021-03-22T11:26:40Z")

</div>

Doing this will still allow the player to add the component again even if it was destroyed? Im kind of new here, would you please please show me what the nodes would look like? I dont know what to connect whit what to what you are explaining. Kind of desperate here

---

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 11:37am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/5 "2021-03-22T11:37:19Z")

</div>

Doing this will still allow the player to add the component again even if it was destroyed? Im kind of new here, would you please please show me what the nodes would look like? I dont know what to connect whit what to what you are explaining. Kind of desperate here

---

<div class="post-metadata">

**Author:** ![GrumbleBunny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GrumbleBunny](https://forums.unrealengine.com/u/GrumbleBunny)\
**Post date:** [March 22, 2021, 11:51am UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/6 "2021-03-22T11:51:05Z")

</div>

You can add / destroy as many times as you like:

 ![333213-promote-to-variable.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/6/ea6857cc958fb1e18a2cfe09d9a8da2e67d3be85.png)

 ![333214-destroy-component.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/8/eb8491b4037474afe70feded0d2fbb4edbeb6f91.png)

---

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 12:00pm UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/7 "2021-03-22T12:00:02Z")

</div>

I truly dont know how to thank you enough!! I was so desperate to solve this!! Thank you so so much! Also, is there a reason as to why using just the “set static mesh” is not working fine? I have used it for other projects and meshes seemed to be fine

---

<div class="post-metadata">

**Author:** ![GrumbleBunny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GrumbleBunny](https://forums.unrealengine.com/u/GrumbleBunny)\
**Post date:** [March 22, 2021, 12:19pm UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/8 "2021-03-22T12:19:29Z")

</div>

Yeah no idea why SetStaticMesh isn’t working for you.

---

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 12:21pm UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/9 "2021-03-22T12:21:21Z")

</div>

Just out of curiosity, is there a way that the same event destroys another mesh object reference object reference and then adds a new static mesh component?

---

<div class="post-metadata">

**Author:** ![GrumbleBunny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GrumbleBunny](https://forums.unrealengine.com/u/GrumbleBunny)\
**Post date:** [March 22, 2021, 12:25pm UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/10 "2021-03-22T12:25:09Z")

</div>

![333215-destroy-then-save.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/3/2a3f498879c5095f3bdbc1884d9f4719a104b73d.png)

---

<div class="post-metadata">

**Author:** ![nmad2792](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nmad2792](https://forums.unrealengine.com/u/nmad2792)\
**Post date:** [March 22, 2021, 10:45pm UTC](https://forums.unrealengine.com/t/removing-and-added-static-mesh-component/480669/11 "2021-03-22T22:45:06Z")

</div>

Cannot even explain how much you helped!! Btw is there any tutorial about packaging a project in ue4.26 to html5?
