I have had frequent problems with various projects being corrupted on Mac OSX 10.9 and 10.10 using UE4 Editor 4.6.x and now 4.7.5. It has happened on ShooterGame example, on simple test projects and now on a project based on FPS Wiki Tutorial. I am using XCode 6.2 on a Mac Pro with 22GB of RAM, a 5770 video card and Mid 2010 2x2.4 Ghz Quad Core Xeon.
I believe I’ve isolated this to class changes in C++. I can recreate it in my current test project by adding code, compiling, running one or many successful tests, then closing project, and attempting to reopen it. I can easily believe that I am creating code that is incorrect in some manner (especially in this case because I am experimenting with creating dynamic TArrays of structs), but fact that editor allows project to work, then save, yet will not permit it to be opened again, seems like it could be a bug. With my current tests, it seems too consistent to be a memory error on my computer. test environment is trivial and has only rudimentary objects and textures (see Wiki FPS Tutorial)
issue shows up on reopening project by editor aborting with a dump. dump always lists whatever class I was working on as culprit in creating a memory error. I can correct corruption by loading XCode and double clicking on .xcodeproj in UnrealProjects/Projectname directory, loading it, removing some code, running a Clean, then a Build and exiting XCode. Then I remove .dylib files in Binaries/Mac directory, restart project and it will load after it recreates .dylib file.
While my code may cause problems, I have recreated this with adding a simple display into a class, testing it, saving it, then attempting to reload project. My question is, is this a bug of UE4 or is it normal to need to have perfect code in previous session to avoid being unable to load project on next invocation of editor?
I have sent several crash reports on this over last month.
EDIT2:
As requested, here is an example of code that does this. I removed UE4 macro struct version I was experimenting with because it vastly complicated issue. Here is simpler, hopefully good code that still reproduces problem. I have made simpler code that also did same thing.
In project/Engine h file, I place this struct definition:
struct FInventoryDefinition {
int32 IType;
FString IName;
};
Then in GameMode.cpp, I place following:
at top:
FInventoryDefinition Inventory[5];
at bottom:
bool AFPSGameMode::LoadInventory() {
Inventory[0].IType=0;
Inventory[0].IName="Machine Gun";
Inventory[1].IType=0;
Inventory[1].IName="Bazooka";
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("Inventory Loaded"));
return(true);
}
In constructor, I place this:
if(LoadInventory()) {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("Inventory Reported Okay"));
}
I compile using Compile button in editor. It completes with a clean compile log and I Play one or more times. code seems to work each time. I then close Unreal Editor and wait a few minutes. Open .uproject file and get a crash with a dump that begins like this:
MachineId:deleted
EpicAccountId:deleted
Generating report for minidump
Application version 4.7.5-2503383+++depot+UE4-Releases+4.7
... built from changelist 2503383
... based on label ++depot+UE4-Releases+4.7
OS version 10.10.2.5396
Running 8 x64 processors
Exception was "SIGSEGV: invalid attempt to access memory at address 0x78d"
Source context from ""
<SOURCE START>
<SOURCE END>
<CALLSTACK START>
AFPSGameMode::AFPSGameMode(FObjectInitializer const&) Address = 0x13d460bfa [/Users/myusername/Documents/Unreal Projects/FPSProject 4.7/Source/FPSProject/FPSGameMode.cpp, line 17] [in UE4Editor-FPSProject-8591.dylib]
UClass::CreateDefaultObject() Address = 0x105820341 (filename not found) [in UE4Editor-CoreUObject.dylib]
ProcessNewlyLoadedUObjects() Address = 0x1059a98aa (filename not found) [in UE4Editor-CoreUObject.dylib]
TBaseStaticDelegateInstance<void ()>::ExecuteIfSafe() const Address = 0x1058517c7 (filename not found) [in UE4Editor-CoreUObject.dylib]
TBaseMulticastDelegate<void>::Broadcast() const Address = 0x1050a6ad8 (filename not found) [in UE4Editor-Core.dylib]
FModuleManager::LoadModuleWithFailureReason(FName, EModuleLoadResult&, bool) Address = 0x10526a720 (filename not found) [in UE4Editor-Core.dylib]
FModuleDescriptor::LoadModulesForPhase(ELoadingPhase::Type, TArray<FModuleDescriptor, FDefaultAllocator> const&, TMap<FName, EModuleLoadResult, FDefaultSetAllocator, TDefaultMapKeyFuncs<FName, EModuleLoadResult, false> >&) Address = 0x10a3c1bda (filename not found) [in UE4Editor-Projects.dylib]
FProjectManager::LoadModulesForProject(ELoadingPhase::Type) Address = 0x10a3d21ce (filename not found) [in UE4Editor-Projects.dylib]
FEngineLoop::LoadStartupModules() Address = 0x104ffd588 (filename not found) [in UE4Editor]
FEngineLoop::PreInit(wchar_t const*) Address = 0x104fe8771 (filename not found) [in UE4Editor]
GuardedMain(wchar_t const*) Address = 0x104ff2b64 (filename not found) [in UE4Editor]
-[UE4AppDelegate() Address = 0x1050017c3 (filename not found) [in UE4Editor]
-[FCocoaGameThread() Address = 0x105150278 (filename not found) [in UE4Editor-Core.dylib]
__NSThread__main__() Address = 0x7fff97ba290a (filename not found) [in Foundation]
_pthread_body() Address = 0x7fff946e7268 (filename not found) [in libsystem_pthread.dylib]
_pthread_body() Address = 0x7fff946e71e5 (filename not found) [in libsystem_pthread.dylib]
thread_start() Address = 0x7fff946e541d (filename not found) [in libsystem_pthread.dylib]
<CALLSTACK END>