Hot reload not taking C++ changes

I’ve added a box collision component to one of my classes with a UPROPERTY and forward declared UBoxComponent* in the header file, included the appropriate box collision header file into my .cpp file, and constructed the box component in the .cpp file as I would any other component.

When I build in VSCode, everything is fine. When I compile in Unreal, I get the typical “1 package changed”, but when I open the blueprint my box collider isn’t there. I restarted the engine, rebuilt in VSCode while the engine was closed, relaunched and the same. I even compiled like 10x in a row in Unreal and every time it kept saying “1 package changed” over and over again, making me think that nothing has actually changed. What is going on? I just want my box collider ):

Note: Live coding is off

Where are you creating the box component?
during the constructor in the cpp with for example:

boxCollider = CreateDefaultSubobject<UBoxCollider>(FName("MyCollider"));

or are you using the new operator in BeginPlay? (that would require you to register it manually)

Yes, I’ve created it within the constructor. I resorted to just adding it in blueprint, but now I want to add additional functionality and the engine isn’t recognizing my changes. It’s ONLY for this class tho, other classes take the changes without issue. I’m thinking I should just remake the class and copy the code

Is it in the source directory? Sometimes visual studio (if you are using it) will save the file to the intermediate folder and screw up the update process. You can also try regenerating the visual studio project by right clicking the uproject file and picking generate.

1 Like

Sadly it is in the source directory lol. I didn’t know about generate tho, I’ll absolutely try that next time. I ended up just re-making the class and chalking it up to an editor bug. Annoying but it works. Thanks for the help!

Hot reload has probably been in the engine for like 5+ years? I still don’t trust it. :sweat_smile:

After more investigation it was because I didn’t know how to use my Perforce server properly lol I never saved the source code to the server so it was reading old code. Gotta love being new lol

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.