Live Coding

Live coding is the feature which allows you to make changes in c++ while the editor is running and immediately “push” compiled changes to the editor. It’s been an awkward topic of discussion because most users were not aware the “feature” actually caused problems including corruption and the general advise has been to not use it at all.

Now that we’re on Unreal Engine 5, visual studio will even tell you it can not start compiling while the editor is open. It seems Live Coding is now disabled by default?

Thing is, if it DID work it would actually save a lot of time if we can put the code on one side and see immediate results on the other. Has this idea been abandoned? Is there a working alternative?

I’ll leave the blueprint alternative out of this for various reasons, as a c++ programmer I don’t see a future in blueprints the way it is.

Update:
I have been using the words “Live Coding” and “Hot Reload” for what I thought was the same system. Keep that in mind. They are similar.

Live Coding vs Hot Reload? - #6 by NilsonLima

Using Live Coding to recompile Unreal Engine Applications at Runtime | Unreal Engine 5.0 Documentation

IMO, it works fine. Enable it in the editor, and use ctrl-alt-f11 to trigger a live coding rebuild.

In UE4, you can’t use it to make changes to code structure (adding functions, properties, etc will pretty much blow up), but in UE5 there have been changes to completely reload associated objects in memory, so i guess it works better there.

I use it all the time when I’m iterating on code.

1 Like

This is good to know. I must be sure it is safe to use for serious development before any form of corruption blows up the entire project. (It even moved away from blueprint entirely except for data assets)

People seem to often be confused by the engine not being changed after doing live coding. Live coding compiles new DLLs, and then switches to them, it does not rebuild the existing DLLs. So, after you have done a live build, the next time you shutdown and restart the editor, you need to do a regular build before hand (or another live coding build after you get in, i guess) for the changes made.

Only corruption I’m aware of is that if you blow up the engine by making changes that aren’t compatible – such as changing the code structure in UE4 – you’ll crash out. Save frequently, and use version control systems. Same thing I’d recommend even if you never touch Live Coding or any other thing that might blow up unexpectedly :smiley:

1 Like

Definitely. I’m just blown away by how often something is suddenly broken in the uasset binary files after 30 commits because an animation pointer was lost for 50 files, or a struct suddenly breaks, or blueprint silently went corrupt. That can’t be fixed automatically. It has been a true horror show so far for me. I truly hope Live Coding won’t add to that XD.

UE definitely has some warts, any software this big is bound to have some, especially as fast as it develops and things get added onto, then eventually redesigned and replaced, over the years. I’m not aware of any widespread common uasset corruption issues, but there’s always new bugs to be found and new ways to mess things up :smiley:

actually… i take that back… i am aware of an easy way to corrupt assets… though i’m not sure if it occurs in stock 4.27 or if it’s an aspect of the heavily modified version i’m using… if I crash the editor after it’s done a temp save, but before i’ve done a regular save, when i bring it up, it will offer to attempt to recover the in progress work. That part works – however, if I PIE before I save all the assets that were recovered, then I end up with really wonky assets sometimes.

1 Like

The person who has decided Live Coding console will be a separate process and window on the taskbar, will have icon identical to Unreal Editor icon and will be impossible to turn off is just purely evil. That person enjoys us developers suffering.

I am not 100% sure about this, but it seems to me i have to disable “Edit/Editor Preferences/Live Coding/Enable Life Coding”, then I can just edit code in Visual Studio and build it there and it works in the Editor too.
I am pretty unsure about the whole “live coding” thing, does it mean I can change the C++ code and then use the Unreal Editor to build it? If that is all… I really prefer to be able to build (=test) my code from the Visual Studio. But perhaps I am missing something here?

I have to add:
I set my project as “Startup Project” and I build not with F7 but with ctrl-b.