Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Make changes to code without restarting editor?

Hi all, I am very new to Unreal Engine. I am a bit confused as I have completed the first lesson in programming for the engine. My issue is: When I make a change in visual studio to my classes, I must close the editor, build the solution in visual studio, then re-open the editor for changes to be applied. I've tried using "compile" in the editor but changes are not reflected. When I try to build in VS while editor is open, build fails. Any help will be greatly appreciated. Thanks in advance.

Product Version: Not Selected
more ▼

asked Mar 24 '14 at 10:07 PM in C++ Programming

avatar image

400 48 54 251

avatar image Dark-Veil STAFF Mar 25 '14 at 12:02 AM

Sorry about that! What sort of change did you make that was not reflected? There are some limitations to this feature currently that we hope to resolve in the future. One of the limitations that we're going to fix is that construction functions are not re-applied after a Recompile.


avatar image Clunk47 Mar 25 '14 at 12:15 AM

Hey Mike, thanks for the reply. I am doing a simple AddOnScreenDebugMessage to display a string to the screen like shown in getting started here. When I change the MyNumber value, Visual Studio fails to rebuild unless I close out UE4 editor, then build in vs, re-open UE4, then the change shows. It just takes so long to not only build, but to close and open the editor for small changes like this.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Okay, this is a known limitation that we are working on for a future release.

Good news! There is an easy workaround!

Instead of compiling using Visual Studio, please click the "Compile" button on the editor toolbar. That will automatically save your code and initiate a compile right from within the editor, and automatically reload your changes afterwards.

We are still working on support for "hot reload" from within Visual Studio. Keep an eye out in future releases!


more ▼

answered Mar 26 '14 at 04:04 PM

avatar image

Dark-Veil STAFF
836 11 8 29

avatar image Clunk47 Mar 26 '14 at 11:19 PM

Well I was doing the compile inside of the editor as well, trying to figure it out on my own, but that makes changes only to my FString variable. It will not reflect changes to any int32, uint32, float or double unless I do the whole closing UE4, recompiling in VS, opening UE4 again, which takes like 2 or 3 minutes just to make a change or add a single variable. And if I make any change whatsoever to a header file, same consequence. This really puts a damper on productivity for me. I'd just use Blueprint, but I'd rather code. Not complaining, just putting out my constructive criticism. I know it's still a WIP. Are you guys planning on packaging a preset coding environment rather than just releasing an extension that requires VS Pro? It'd be cool not to have to pay so much money for VS just to code in Unreal properly. It would also be nice not to have to wait so long for references to be imported to VS every time you want to add a new class. I understand these should probably be asked as separate questions though, they just had to do with the issue I'm having. I'll wait for future release, whenever that may be, thank you for the assistance.

avatar image Clunk47 Mar 27 '14 at 12:25 AM

As a workaround for now, I had right click on my Actor in the hierarchy and replace it with itself after compiling. I'm guessing that old actors keep old values, so they must be replaced after changes and recompilation. It's kind of weird that strings update but ints don't if I don't do it this way, but this sure beats restarting the engine every time I want to test changes.

Screenshot posted below.

fix.png (109.6 kB)
avatar image idbrii Sep 05 '15 at 12:07 AM

Is there a solution, bug number, or trello task for hot reloaded building from Visual Studio?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

If you are making some new functions you have to close the editor and build it from VS, but if you are only editing some existing function just compile from the Unreal Editor toolbar..

more ▼

answered Mar 26 '14 at 06:24 PM

avatar image

111 1 3 5

avatar image Clunk47 Mar 26 '14 at 06:32 PM

Yeah it doesn't work lol. I posted a comment below the accepted answer but I guess it got removed or is in moderation or something. I'm only trying to change values, not anything in the header files, I know I can't make changes to generated code while editor is open. Compiling via the toolbar only updates my FString values, not int32, uint32, double or float.

avatar image Dark-Veil STAFF Mar 26 '14 at 09:26 PM

That is really strange. We're not able to reproduce this here yet. Can you reproduce this in one of the sample games that have C++ code? If so, please let us know. I'll keep testing it.


avatar image piinecone Apr 10 '14 at 12:57 AM

I can reproduce this. In case it's relevant, this is my environment:

  • OSX 10.9.2

  • XCode 5.1

I was working through this programming guide: https://docs.unrealengine.com/latest/INT/Programming/QuickStart/index.html

If I change the on-screen debug message text value and recompile from within the editor, the changes take. However, if I change the int32 value in XCode and then recompile in UE4, the number remains the same until I replace the actor.

In the example tutorial, the MyNumber assignment occurs in AHelloWorldPrinter::AHelloWorldPrinter(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP); if I reassign the value in void AHelloWorldPrinter::BeginPlay(), the new value is displayed. It appears the Constructor is not called again after the in-editor recompile unless the actor is replaced.

I apologize if any of this was confusing. I'm brand new to Unreal and C++.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You have to close the Editor only if you add new Classes, Functions, Properties or other C++ code with attributes(macros) such as UCLASS() and UPROPERTY(). This is because these attributes add reflection abilities to the Classes, Functions or Properties. In order for the Editor to refresh itself and be able to use the reflected new C++ code, it needs to restart. However, if you add any C++ code without attributes(macros) you can freely compile in VS and it will compile successfully. You simply say "I don't want the Editor to be aware of the new C++ code I just wrote". Unfortunately this way you won't be able to call a function in a Blueprint for example, because the function is not reflected and the Editor doesn't know that such a function exists. You won't be able to use any code in the editor, but that doesn't mean that the code won't do it's job. I personally like the Blueprint scripting, but I prefer to do everything from code (Call me an old-school guy :D). Anyway, this is how I understand this concept, so I may not be entirely right.

You can learn more about the attributes(macros) in this blog post and how they add reflection abilities to the C++ code.

more ▼

answered Jun 22 '14 at 03:18 PM

avatar image

334 21 22 43

avatar image gamescodedogs Oct 10 '15 at 09:36 PM

Hi guys,

Any news about hot reloading after compiling cpp in VS/Xcode? My situation now looks like this:

  1. Create empty project, adding to game mode:

    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("HELLO WORLD"));

  2. Press compile in editor button, run, see HELLO WORLD text

  3. Updating code in XCode

    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("UPDATED"));"

  4. Compile in XCode

  5. Run in editor, see HELLO WORLD text

  6. Restart the editor, run, see HELLO WORLD text

  7. Press compile in editor button, run, see UPDATED text

I have a dream to compile in IDE, return to editor and press play. Is that actual direction of engine development?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question