Download

C++ code does not update until editor is restarted

I have been trying to incorporate more c++ programming in my project and earlier I was using a struct and I just added one item to the struct but after hitting the compile button in the editor, the nodes using the struct did not update with the new item. It was only until after restarting the editor that it appeared.

It’s not only just structs and this has happened a few times before where code didn’t take into effect until after restarting the editor. Is there anything I can do to prevent this or minimize this inconvenience?

Changes to the layout of structs and classes normally require a restart. The editor will try to update functions, classes and structs, but this will usually result in messing things up even further by spamming “HOTRELOADED type” everywhere. I usually leave the editor closed when programming in C++. It is less of an inconvenience than it sounds.

There is live coding, which in my experience is practically a useless gimmick. Theoretically, as long as you don’t change the layout of your classes, you can update function code(logic, algorithms) and see the changes in real-time, where real-time is defined as several minutes of compiling code. What makes it almost irrelevant is the fact that is already possible as long as you don’t change the layout and know what you are doing. Still, it exists, and you may find it useful.

In short, C++ changes the engine itself. It requires a reload most of the time, unless you are changing just execution code. You may also have to delete instances of actors if you change the parent class in C++. UE4 can go full diva if you don’t update instanced actors whenever you make significant changes to their parent class.

This is something that is well known, Hot Reload Button is Broken since I knew UE4. never been fixed, Editor Restarting is a good habit instead of hot-reload it will save you a lot of frustration when it comes to element assignment and crashes.
Just press F5 and let VS do the work.
And its not something that is bad, Cryengine when I used it also needed to be restarted after each build. I think it has something to do with C++ as it recompiles the dlls.

finally as mentioned above by DanteWingates as well, Live Coding is a personal preference, I liked it and used it a lot when it came out but never used it after that short period of time.

Thanks for the responses. I guess this is just one of the things to get used to with previous Unity experience. This does make me a bit more tempted to just do what I was planning to do in C++ in Blueprints instead since it seems less of a hassle. I will definitely remember this when working with C++.

Also is the compile button in the editor or the build solution option in VS preferred when programming in C++? I’ve heard different things and that one sometimes works over another.

Same here. I was thinking maybe it has anything to do with the fact I am coding in a plugin module,but now it looks that any change made to class structure doesn’t get reflected by the editor until it is restarted. This is something Epic must put as a first priority. Working with VS and launching the editor from within is very inconvenient, especially when the hardware is not very strong.