I have noticed recently that if I write a new function in my C++ class and attempt to build and hot reload my project, the second I add the new function to my level blueprint, the blueprint is unable to save, saying that it has an external reference.
I have been able to reproduce this many times without fail, and it is present in the latest 4.8.2 retail build of UE.
Thank you for reporting this issue, unfortunately I’m having issues reproducing the issue. To be clear about exactly what I’m doing to reproduce this, I’ll list off my steps.
Create a new project
Add a new class of the Actor type called MyActor
Copy and paste your function into the .cpp and .h of my MyActor class but change ‘AUtilities’ to ‘AMyActor’
Compile in Visual Studio and wait for UE4 to Hot Reload
Create a new blueprint of the type MyActor
In the event graph for the new blueprint, right click and type in ‘Square’ and add the function under ‘Integer’ (There is another Square function that is a default part of the engine’s code)
Press the ‘Save’ icon at the top of the blueprint editor beside ‘Compile’
After doing these steps, I don’t receive an error. I’ve also tried adding a print string and hooking it up to begin play and the Square function to be sure that it was being used to see if that would cause the issue to no avail. Have I missed a step that is crucial to the repro? Also, can you provide me with a screenshot of the exact error you’re getting?
I guess I failed to mention that it has to be added to an existing blueprint, like the level blueprint or another actor, and not an instance of the Utilities actor.
And UE4 does have a function to square floats, but not integers, so that’s why I wrote that one.
This has happened to me before. To solve the issue you have to close everything, open the visual studio project and compile it then you can open the editor again. It’s because sometimes the hot reload doesn’t work when creating new nodes and doesn’t load them onto the program. What also may be happening is that you have an error inside your code and you haven’t addressed it yet.
I tried changing up my steps a bit. Directly after creating the project, I created a blueprint of the Character class before adding my new C++ class for MyActor. After adding the function from your original post and hot reloading, I was able to add a call to the function to both the Character blueprint that I created and the Level Blueprint without any saving issues occurring. I also tried this on a different machine with Windows 8.1 just to be sure. Are there any other details you could possibly provide?
We haven’t heard from you in a while. Are you still experiencing this issue? I would like to know if you have any more steps you could provide that may lead to a successful reproduction of this issue. In the meantime, I’ll be setting this issue as resolved as I cannot progress further without your input. Please feel free to comment and the issue will reopen.
I’ve run into this issue a lot actually even with 4.14. I like to use c++ to create a blueprint function library that handles a bunch of stuff which is easier to work with in code. As a result of this, any actor in the editor that implements any of the custom blueprint nodes that i create in the blueprint function library in c++ could not be saved after a recompile / hot reload. I assumed i had to restart the editor after this process (which kind of takes away the point of a hot reload), but recently discovered that if i just use ‘refresh all nodes’ in all impacted actors that couldn’t save, i could start saving again. hopefully this helps anyone else that might run into this issue.