A couple of days ago I created a post called Unreal engine behavior problem
I now wish to report a problem and possible major bug with the unreal engine in regards to a specific problem I am having using the unreal engine.
In short, I am using c++ for my project and I am trying to load static mesh assets into the unreal engine in multiple different classes to spawn during run time. These meshes are loaded within the constructor of one Actor class, and one Character class using the ConstructorHelpers::FObjectFinder function and the line of code
ConstructorHelpers::FObjectFinder<UStaticMesh>voxel_shape(*mesh_path_name);
What was happening was that the project would crash for not apparent reason and at unpredictable times. I could not restart the unreal engine editor (it kept crashing at 71% initialisation) unless I commented out the lines of code to load the staitc mesh assets and recompiled the project. The editor would also crash when trying to open it after closing the editor after a successful coding session without performing this as well. After this,the editor would not crash when restarting. I then uncommented the above code and recompiled so as to continue on with my work. This is now occurring far too often I decided to investigate thoroughly and try to find alternative methods of loading my meshes. The whole problem is with the function
ConstructorHelpers::FObjectFinder
So I began to look for alternatives and the only alternative method available that is a LoadObject function. The line of code using this is
UStaticMesh *voxel_mesh = LoadObject<UStaticMesh>(NULL, *mesh_path_name, NULL, LOAD_None, NULL);
Using this function solved the previous problem with limited success, but again caused problems and crashed the editor.
After much intensive effort I have found this.
When I am compiling newly written code, I noticed messages deleting old .dll files for hot reload would appear in the output message panel in visual studio. When this occurred the ConstructorHelpers::FObjectFinder to load static mesh assets would all of a sudden not be able to load the static meshes it previously could and, and where I was careless and did not test for this, the editor would crash, and not be able to restart unless commenting out as describe earlier was performed.
When the using the LoadObject function to load static meshes, there is 100% success upon the first instance of loading a mesh, but any sub sequence attempt to reload any previously loaded mesh would be unsuccessful, cause a null pointer to be generated, and crash the editor were testing for this condition was not not performed. However I can restart the editor without any of the previous problems that ConstructorHelpers::FObjectFinder was causing.
So I am in a no win situation. I need to load the same mesh asset multiple times and thus cannot use LoadObject. But if I use ConstructorHelpers::FObjectFinder multiple times to load the same mesh, but while compiling code, some old hot reload .dll files could be deleted rendering the ability to find the meshes required to load null and void, and exiting the editor at any stage would crash it when trying to restart it without the commenting, recompile, start editor, uncomment, recompile method mentioned.
I consider this a major flaw and a most probable bug. If no one else has come across this or it is unknown, it would be a surprise to me.
if it is not a bug, I would like to know the correct method to perform the task of loading static meshes into an unreal project to be used multiple times without having the above described problems. I see this as a breaker to what I am doing within my project and cannot proceed much further with this behavior of UE.
I hope I was clear enough about what I have described for it to be resolved, or to inform myself and any other interested parties what is causing this and what, if any workarounds are available to avoid this.
Thanks in advance and much appreciate for any information or help that can be given.