Tried to be as descriptive as possible with the title.
I have a BPHUD and a CodeHUD. BPHUD is a child of CodeHUD.
Whenever I change CodeHUD, compile, and then go into the BPHUD to add the function or alter a variable I’ve added and then hit compile my engine crashes. Restart. Everything is fine and I can add the functions, compile, save, ect. Then I need to add code and it’s rinse and repeat.
Added a CodePlayerState.
Compiled.
Right click CodePlayerState and made a blueprint class in another folder.
Went into C++ and added 3 public variables read-writeable by blueprints with the format:
Then I went back to UE4, save all, compiled C++ in UE4. Saved all. Opened up BPPlayerState. Saved. Compiled. No problems. Changed the values of the variables (ie MaxHealth changed to 175); Saved. No problems. Compiled. Crash.
When I do anything in the blueprint after compiling it crashes ONLY if I’ve made a change. A compile with no changes to CodeHUD doesn’t crash BPHUD if I change it. Even just adding a useless operation, compiling, and trying to do anything in the blueprint will crash it.
i have copy pasta your code earlier to give it a try. There was no issue whether in a new project (3rd person) or old project. So the suspect got to be from some place else.
I even added a (float + float = health increment) to the blueprint to see incremental health change to the health bar and there wasnt any issue.
Just to recap what i have done…
create a new 3rd person project with no added content.
create File >> new c++ class
copy pasta the c++ code as posted earlier
save in VS 2015
compile in editor
create BP (Child) of the C++ code
change HUD of the game mode to this BP.
add BP nodes to the blueprint.
8.1) event receive draw hub ==> Health increment (as mentioned earlier) ==> draw player health rectangles.
Just a shot in the dark, but HotReload can do funny things sometimes. Changing variable values shouldn’t be one of them, but when changing the header file of your c++ class, it’s always good to recompile from vs or restart the editor instead of using HotRelaod. The problems are not always immediately visible. Just something to keep in mind when funky stuff happens.
so I should compile in Visual Studio and see if that fixes it? The editor crashing is fine as long as it’s not unexpected. As in, I was concerned that I was doing something poorly/wrong. But if that’s expected behavior and I’m simply trying to push HotReload too far then that’s fine.
But really all I’ve done is add variabls and functions to the class, save all in vs, and then hot reload. Haven’t added any headers at all 99% of the time (a single class uses the kismet math library but I only added it once of course). Workflow is: Add part of function. Test. Tweak numbers. Test. Add next “sentence” to function. Test. Crash X times after all of those compiles. It’s not every time. Just most of the time. But again, if it’s expected that’s fine. Iteration time goes down significantly but not a huge deal.