What is the most lightweight way to write and compile code?

I’m not sure if this is right, but from what I’m reading around the web I’m getting the feeling that in order to work with code in UE4, I may not in fact have to compile the engine.

Is this right?

I’m working on a project that contains some code, what is the easiest way for me to alter and compile that code?

Do I have to build the engine, or can I get away with skipping that part? I’ve seen people talk about ‘code projects’ vs ‘building the engine’, but not totally sure what that means.

I’m guessing that you don’t actually have to compile the engine unless you want to actually change it. is that right? Can i just compile my code and run it from the normal launcher? (as in, not the one that you would run from VS)

I’m pretty sure you can use the compile from within the launcher to hot reload your c++ code project. In general building in visual studio isn’t that painful, you can right click the game solution and select just to build that.

I’m also 99% sure when you build the project it checks if the engine is modified and if it isn’t just uses the existing generated binaries, rather than rebuilding the entire engine solution.

You do not have to build the engine every time you compile your code. If you create the code project from within the editor only your code will be compiled and linked to the engine code. Matter of fact, the engine code should show as readonly in VS if you choose this option. And is pre-compiled.

IF you want to modify the engine code, you will need to download the code from GitHub, run some files, and spend about an hour compiling the code, I assume this is not the common use case, and you likely didn’t do this from the start, nor will you need to do this now.

So to answer your question, the easiest way to modify game code, would be to load it into VS, right click on the game project, and click build.

BTW just for general info: If you click “Build Solution” from the menu bar at the top, the build will now fail in 4.9, you need to right click on your game project and select build there.

careful with a full source (downloaded from github) and make sure you hit build and not rebuild project :wink: made that mistake myself once, it will clean the whole project (engine and all), but this isn’t a concern from a binary download.

if i’ve built the code in VS, is there a way to remove that so I’m again just using the pre-compiled version? I’m having issues with the project building so I’d like to try reverting to whatever the defaults were.

The easiest way I know of to tell if you are using the binary distribution or the custom build from github is to look at the version number of you project in the launcher. If it says something like 4.8 or 4.9.1 then you are using the binary distro, if it says “Other” then you are using a custom build.

If it gives a version number, you are already on the default.

If it says other then you need to find the .uproject file in the head of you project fold and right click and choose the option to switch which version of unreal source you are running under.

I’m not sure if this is right, but
from what I’m reading around the web
I’m getting the feeling that in order
to work with code in UE4, I may not in
fact have to compile the engine.

Is this right?

Right you not have to compile the engine to work with code. Until you are planing to modify the engine.

I’m working on a project that contains
some code, what is the easiest way for
me to alter and compile that code?

I suggest, use the binary version of the engine. Which you get from the Epic Game Launcher->Library. And to work with code under Windows use Visual Studio 2013. My latest news is that VS Solution creation for UE4 in special 4.8 do not work with VS2015. The support for VS2015 will come with the UE 4.10 engine version. Under OSX you will work with the UE4 Editor and XCode. Regarding Linux I don’t know. A common workflow under windows would be. Create a Code Project from the UE4 Editor. The UE4 Editor will then open the VS Solution, you will compile your first code. From this point you can modify you code in Visual Studio or other Text Editors (But I still sugest VS) and just press the compile button in the UE4 Editor to compile your code and hot reload it into the editor. So… Edit code in Texteditor/VS, Start compile from UE4. To debug your code, you have to lauch your UE4 Project from Visual Studio debugger instead the Epic Game Launcher.

Do I have to build the engine, or can
I get away with skipping that part?
I’ve seen people talk about ‘code
projects’ vs ‘building the engine’,
but not totally sure what that means.

As all answer right away say, you do not have to build the engine if you use the engine binary from the Epic Game Launcher. And to clarify that “code projects” and “building the engine” means
“Code projects” are projects there the developers write C++ code to extend your game/project.
You don’t have to write code in a game/project, because a lot in UE4 can be done in Blueprint the Epic visual sripting language. But as you say you use code you would use a code project.

“Building the engine” is if you grab the code base from GitHub(not the epic game launcher) and compile/build the complete engine code by your self. As written I didn’t suggest it until you want to change the engine. Extending the Engine with modules is a other topic…

Why is that dangerous?

its not dangerous, it just cleans everything, and starts rebuilding, everything… So if you are building on a Github unreal source download, it takes about an hour to just get to your code.