# Transient component is still saved/loaded

**URL:** <https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742>\
**Category:** C++\
**Tags:** procedural-mesh-comp, unreal-engine, question, CPP\
**Created:** [December 8, 2016, 8:05pm UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742 "2016-12-08T20:05:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![devast3d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@devast3d](https://forums.unrealengine.com/u/devast3d)\
**Post date:** [December 8, 2016, 8:05pm UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/1 "2016-12-08T20:05:26Z")

</div>

I’ve got following code in my actor

```
// header
...
#if WITH_EDITOR
	UPROPERTY(Transient)
	class UProceduralMeshComponent* ProceduralMesh;
#endif
...
// cpp, constructor
...
#if WITH_EDITOR
	static ConstructorHelpers::FObjectFinder<UMaterial> GridMaterial(TEXT("Material'/Game/Common/M_PathGrid.M_PathGrid'"));
	ProceduralMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"), true); // Notice true as second parameter
	ProceduralMesh->SetMaterial(0, GridMaterial.Object);
	ProceduralMesh->SetupAttachment(RootComponent);
#endif
...

```

The intention is simple: I don’t want this component to be saved or loaded to disk since it contains large mesh and should only be avaialble in editor. It’s used for debugging purposes only.

However it’s still saved when I press save and loaded when I open level after editor restart. Also tried SkipSerialization, didn’t help. And I see this component when I select the actor in the editor.

How can I totally exclude component from being serialized? I will always generate its content on the fly when necessary.

---

<div class="post-metadata">

**Author:** ![Max\_Pixel\_FFL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Max\_Pixel\_FFL](https://forums.unrealengine.com/u/Max_Pixel_FFL)\
**Post date:** [November 22, 2017, 3:16am UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/2 "2017-11-22T03:16:27Z")

</div>

Did you ever figure this out?

---

<div class="post-metadata">

**Author:** ![MickD777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MickD777](https://forums.unrealengine.com/u/MickD777)\
**Post date:** [November 22, 2017, 2:17pm UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/3 "2017-11-22T14:17:10Z")

</div>

This is how the engine does it:

```
    #if WITH_EDITOR && WITH_EDITORONLY_DATA
ProcMesh = CreateEditorOnlyDefaultSubobject<UProceduralMeshComponent>(TEXT("GenMesh"));
    #endif

```

Put this in the constructor, no need to put the property Transient, it wont exist out of the editor.

---

<div class="post-metadata">

**Author:** ![devast3d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@devast3d](https://forums.unrealengine.com/u/devast3d)\
**Post date:** [November 26, 2017, 4:57pm UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/4 "2017-11-26T16:57:56Z")

</div>

AFAIR, no. I just dropped this code.

---

<div class="post-metadata">

**Author:** ![Ari\_Epic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ari_epic/32/1225266_2.png) [@Ari\_Epic](https://forums.unrealengine.com/u/Ari_Epic)\
**Post date:** [July 23, 2023, 7:06pm UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/5 "2023-07-23T19:06:50Z")

</div>

This is how you mark a component as transient, it will not be saved into the level:

```auto
ProceduralMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"));
ProceduralMesh->SetFlags(EObjectFlags::RF_Transient);

```

---

<div class="post-metadata">

**Author:** ![yoponchik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yoponchik](https://forums.unrealengine.com/u/yoponchik)\
**Post date:** [August 5, 2024, 4:36am UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/6 "2024-08-05T04:36:02Z")

</div>

What is the difference between `EObjectFlags::RF_Transient` and `UPROPERTY(Transient)`?

---

<div class="post-metadata">

**Author:** ![Ari\_Epic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ari_epic/32/1225266_2.png) [@Ari\_Epic](https://forums.unrealengine.com/u/Ari_Epic)\
**Post date:** [August 7, 2024, 12:53pm UTC](https://forums.unrealengine.com/t/transient-component-is-still-saved-loaded/378742/7 "2024-08-07T12:53:02Z")

</div>

`EObjectFlags::RF_Transient` makes it so that the object doesn’t get saved into the level.  
`UPROPERTY(Transient)` makes it so that the property never gets serialized or saved.
