# My C++ classes disappear after reopening the project. Why?

**URL:** <https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, question\
**Created:** [April 21, 2022, 6:49pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990 "2022-04-21T18:49:15Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f899ea4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f899ea4a](https://forums.unrealengine.com/u/anonymous_user_f899ea4a)\
**Post date:** [April 21, 2022, 6:49pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/1 "2022-04-21T18:49:15Z")

</div>

I have created the actor MyEarth which loads a staticmesh from Content Directory and the class MyGameModeBase (derived from GameModeBase) which spawns an instance of MyEarth in a position. Everything works fine, the actor appears as expected.  
But,after saving eveything,when i reopen the project, my c++ classes MyEarth and MyGameModeBase are no longer in the C++Classes Folder of the Content Drawer of the Editor,and when i run the project,nothing appears and no MyEarth actor in the Outliner.  
Obviously the class code is there,in the Source Directory of the project.  
Why does this happen? Similar problem in a my previous post with blueprint.  
I find NO solution. Maybe a bug ? Thanks in advance !!! This problem is a stop with Unreal Engine for me.  
This is part of the code:

MyEarth.cpp:

AMyEarth::AMyEarth()  
{

```
PrimaryActorTick.bCanEverTick = true;
root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
SetRootComponent(root);
earth = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Earth"));
static ConstructorHelpers::FObjectFinder<UStaticMesh>MeshAsset(TEXT("StaticMesh'/Game/earth.earth'"));
earthMesh = MeshAsset.Object;
if (MeshAsset.Object)
{
	UE_LOG(LogTemp, Warning, TEXT("MESHOBJECT NOT NULL "));
	earth->SetStaticMesh(earthMesh);
            earth->SetupAttachment(root);
}
else
	UE_LOG(LogTemp, Warning, TEXT("MESHOBJECT IS NULL"));

```

}  
/////////////////////////////

MyGameModeBase.cpp:

void AMyGameModeBase::BeginPlay()  
{  
Super::BeginPlay();

```
AMyEarth* obj = (AMyEarth*)GetWorld()->SpawnActor(AMyEarth::StaticClass());
if (obj)	
   obj->SetActorLocation(FVector(-100, 350, 500));

```

}

---

<div class="post-metadata">

**Author:** ![zeaf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zeaf/32/1108035_2.png) [@zeaf](https://forums.unrealengine.com/u/zeaf)\
**Post date:** [April 21, 2022, 9:27pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/2 "2022-04-21T21:27:33Z")

</div>

Are you launching through the launcher or are you launching through your IDE? Try deleting your intermediate and binaries folders, and then try launching the project again. It will have to rebuild your code but it should work. If you are using your IDE to launch, make sure you’re building using the Development Editor configuration, because this is what the launcher uses.

---

<div class="post-metadata">

**Author:** ![Marshfellow](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/marshfellow/32/472733_2.png) [@Marshfellow](https://forums.unrealengine.com/u/Marshfellow)\
**Post date:** [April 22, 2022, 3:28am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/4 "2022-04-22T03:28:08Z")

</div>

same here. I’ve updated to 5.0.1 today. Didn’t experience something like this before. ☹

---

<div class="post-metadata">

**Author:** ![SandeepKumarP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SandeepKumarP](https://forums.unrealengine.com/u/SandeepKumarP)\
**Post date:** [April 22, 2022, 3:41am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/5 "2022-04-22T03:41:28Z")

</div>

I’m using Live Coding in UE 5 since Early Access. I don’t think that’s the problem. Live Coding worked fine in Preview builds also (from Epic Launcher) and I don’t have any issues with 5.0.1 either. I think further investigation is needed as Live Coding might not be the culprit in my opinion.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f899ea4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f899ea4a](https://forums.unrealengine.com/u/anonymous_user_f899ea4a)\
**Post date:** [April 22, 2022, 8:17pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/6 "2022-04-22T20:17:25Z")

</div>

Thank you Zeaf. I launch the project from the launcher and i use the ide to write c++ code.  
I have deleted intermediate and binaries folders,then the launcher asks me if i want to rebuild the project. After that,when i open the project,my classes reappear again but when i open visual studio,the editor tells me that the project does not exist.  
So,after deleting intermediate and binaries folders and rebuilding

- i close ide and project,and then open again the project
- In World Settings/ GameMode override,i select MyGameModeBase (derived from GameModeBase),this is fundamental!
- if i open visual studio,the project is there,with all the code.
- AND EVERYTHING WORKS

---

<div class="post-metadata">

**Author:** ![zeaf](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zeaf/32/1108035_2.png) [@zeaf](https://forums.unrealengine.com/u/zeaf)\
**Post date:** [April 22, 2022, 11:40pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/7 "2022-04-22T23:40:57Z")

</div>

One more thing you can do if you find yourself opening the project from the launcher is to go to Edit → Editor preferences, search for “Force compilation” and tick the box there. That way your project will automatically compile the code if there are any changes any time you launch it from the launcher or by double clicking the uproject file

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f899ea4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f899ea4a](https://forums.unrealengine.com/u/anonymous_user_f899ea4a)\
**Post date:** [April 23, 2022, 11:34am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/8 "2022-04-23T11:34:48Z")

</div>

Thank you Zeaf 👍 👍 👍

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f899ea4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f899ea4a](https://forums.unrealengine.com/u/anonymous_user_f899ea4a)\
**Post date:** [April 23, 2022, 12:28pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/9 "2022-04-23T12:28:03Z")

</div>

Small update. I forgot to write that before opening visual studio you need to Refresh Visual Studio Project from Tools of Unreal Engine Editor,otherwise visual studio keeps saying that the project doesn’t exist.  
Thanks 😉

---

<div class="post-metadata">

**Author:** ![bdeniz19971](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bdeniz19971](https://forums.unrealengine.com/u/bdeniz19971)\
**Post date:** [December 18, 2022, 4:17pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/10 "2022-12-18T16:17:06Z")

</div>

In my case, i just pressed compile button and then it compiled, then all the classes were visible again.

---

<div class="post-metadata">

**Author:** ![Huncowboy1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Huncowboy1](https://forums.unrealengine.com/u/Huncowboy1)\
**Post date:** [March 14, 2023, 2:06pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/11 "2023-03-14T14:06:56Z")

</div>

I have followed the steps here, but I am still missing several C++ files and also folders. I do have live coding enabled. Deleting binaries and intermediate folders, then regenerating the VS file does not help at all for me. Interestingly this is not happening to my colleague. Both of us on 5.1,

---

<div class="post-metadata">

**Author:** ![Gabriel.Brz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gabriel.brz/32/732441_2.png) [@Gabriel.Brz](https://forums.unrealengine.com/u/Gabriel.Brz)\
**Post date:** [July 24, 2023, 4:17pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/12 "2023-07-24T16:17:11Z")

</div>

So to be short, I faced the same problem and found a solution. The first tip is always to Open the project from the launcher. For some reason, opening a project from IDE make the compiling process weird.

When you open the project, you may find none of your C++ code available! At this point, you should hit the C++ compile button to get your codes back.

 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/e/baeafaa7a2e3436c2cf17c3b69d1b6dbc727eb23.png)

But still, the changes you made to your level may not be available. Then you have to Build the level, and everything will be where you left it before.

 ![2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/5/8e53cd5b0343d0840153cc3894e986b600a34b69.png)

I don’t know how to stop this from happening. But it should be enough to save your efforts. Also, take note that after applying this, all the changes you lost could return, not only the last one.

I hope this work for you guys as well.

---

<div class="post-metadata">

**Author:** ![facepainter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@facepainter](https://forums.unrealengine.com/u/facepainter)\
**Post date:** [October 6, 2023, 11:24am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/13 "2023-10-06T11:24:21Z")

</div>

this works for me!! thanks a million!

---

<div class="post-metadata">

**Author:** ![mattastic520](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mattastic520](https://forums.unrealengine.com/u/mattastic520)\
**Post date:** [March 13, 2024, 4:08am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/14 "2024-03-13T04:08:57Z")

</div>

This worked for me on UE5.3 without needing to delete the intermediate and binaries folders. Thank a lot!!

---

<div class="post-metadata">

**Author:** ![007havegone](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@007havegone](https://forums.unrealengine.com/u/007havegone)\
**Post date:** [August 4, 2024, 5:54am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/15 "2024-08-04T05:54:49Z")

</div>

I have regenerate the uporject, but it does not work. I have checked the `Show C++ Classes`. But I only see the Content, and Engine foler in the Root.

---

<div class="post-metadata">

**Author:** ![PlaidML](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PlaidML](https://forums.unrealengine.com/u/PlaidML)\
**Post date:** [August 20, 2024, 6:20am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/16 "2024-08-20T06:20:35Z")

</div>

Thx, Zeaf.  
I just faced the same problem in 5.4.3 and your solution works.  
I think this is obviously a bug and needs to be fixed quickly by Epic.

---

<div class="post-metadata">

**Author:** ![Rekatha](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rekatha/32/969968_2.png) [@Rekatha](https://forums.unrealengine.com/u/Rekatha)\
**Post date:** [August 23, 2024, 4:33am UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/17 "2024-08-23T04:33:17Z")

</div>

I found the root issue is from live coding. Everytime I relaunch UE5.4 with live coding enable, all my c++ will disappear. But my c++ still appear if live coding is disabled. Defenitely bug and Epic need to fix this asap.

---

<div class="post-metadata">

**Author:** ![dcobolb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dcobolb](https://forums.unrealengine.com/u/dcobolb)\
**Post date:** [January 12, 2025, 2:38pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/18 "2025-01-12T14:38:47Z")

</div>

Hi, I am also in this situation. I start learning coding in c++ in unreal (UE5.5.1). So i did a first tiny code to move a cube in the scene in x axis, all worked properly, BUT, by adding a second class to code something else in the scene or after closing my scene and re opening it, my c++ class just vanished. After weeks of seeking on web to find a solution, i am still stuck in this really frustrating issue from unreal. It is a real no-go for me.  
Even if i disable live coding etc etc i get the same result-\>class vanished.  
I use microsoft visual studio 2022 with unreal plugin to get it working with unreal.  
Finding a solution would help me a lot.  
What the hell is the solution to this issue??  
thks,

---

<div class="post-metadata">

**Author:** ![ryzen9700XXL](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ryzen9700xxl/32/1225483_2.png) [@ryzen9700XXL](https://forums.unrealengine.com/u/ryzen9700XXL)\
**Post date:** [July 16, 2025, 1:13pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/19 "2025-07-16T13:13:05Z")

</div>

Thank you so much, saved me a lot of time

---

<div class="post-metadata">

**Author:** ![madmortigan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@madmortigan](https://forums.unrealengine.com/u/madmortigan)\
**Post date:** [November 27, 2025, 11:06pm UTC](https://forums.unrealengine.com/t/my-c-classes-disappear-after-reopening-the-project-why/535990/20 "2025-11-27T23:06:23Z")

</div>

UE5.6: This issue still exists and the following seem to work for me:

To get your classes back in Content Browser: Compile in UE editor

To get your C++ Actors in the Level back: Build all levels or Build Geometry (in the Build menu)
