Applies to 4.9 and 4.8.3 at least. Does not repro on 4.7.3. Sample repro project attached, reproduces on stock 4.9. The editor will crash as soon as Play is clicked.link text
Description : Any Actor that derives from AStaticMeshActor, that also has at least one other component, will crash the engine when cloned using SpawnActor with the template argument set to an existing, valid instance (cloning the actor).
The sample provided does exactly that; it has an actor deriving from AStaticMeshActor, and clones itself in BeginPlay. This is already setup in the level CrashLevel for your convenience.
Here is a callstack of the crash:
UE4Editor-Core-Win64-Debug.dll!FMallocTBB::Realloc(void * Ptr, unsigned __int64 NewSize, unsigned int Alignment) Line 90 C++
UE4Editor-Core-Win64-Debug.dll!FMemory::Realloc(void * Original, unsigned __int64 Count, unsigned int Alignment) Line 62 C++
UE4Editor-Core-Win64-Debug.dll!TArray<wchar_t,FDefaultAllocator>::AddUninitialized(int Count) Line 1311 C++
UE4Editor-Core-Win64-Debug.dll!FPaths::CollapseRelativeDirectories(FString & InPath) Line 614 C++
UE4Editor-Core-Win64-Debug.dll!FPaths::ConvertRelativePathToFull(const FString & BasePath, const FString & InPath) Line 778 C++
UE4Editor-Core-Win64-Debug.dll!FPaths::ConvertRelativePathToFull(const FString & InPath) Line 762 C++
UE4Editor-Core-Win64-Debug.dll!FWindowsPlatformFile::NormalizeFilename(const wchar_t * Filename) Line 455 C++
UE4Editor-Core-Win64-Debug.dll!FWindowsPlatformFile::GetTimeStamp(const wchar_t * Filename) Line 519 C++
UE4Editor-Core-Win64-Debug.dll!FFileManagerGeneric::GetTimeStamp(const wchar_t * Filename) Line 460 C++
UE4Editor-CoreUObject-Win64-Debug.dll!FPackageName::FindPackageFileWithoutExtension(const FString & InPackageFilename, FString & OutFilename) Line 590 C++
UE4Editor-CoreUObject-Win64-Debug.dll!FPackageName::DoesPackageExist(const FString & LongPackageName, const FGuid * Guid, FString * OutFilename) Line 632 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCookOnTheFlyServer::Cache(const FName & PackageName) Line 792 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCookOnTheFlyServer::GetCachedStandardPackageFileFName(const UPackage * Package) Line 751 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCookOnTheFlyServer::MarkPackageDirtyForCooker(UPackage * Package) Line 2250 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCookOnTheFlyServer::OnObjectUpdated(UObject * Object) Line 2234 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCookOnTheFlyServer::OnObjectModified(UObject * ObjectMoving) Line 2216 C++
UE4Editor-UnrealEd-Win64-Debug.dll!TBaseUObjectMethodDelegateInstance<0,UCookOnTheFlyServer,TTypeWrapper<void> __cdecl(UObject * __ptr64)>::Execute(UObject * <Params_0>) Line 682 C++
UE4Editor-UnrealEd-Win64-Debug.dll!TBaseUObjectMethodDelegateInstance<0,UCookOnTheFlyServer,void __cdecl(UObject * __ptr64)>::ExecuteIfSafe(UObject * <Params_0>) Line 772 C++
UE4Editor-CoreUObject-Win64-Debug.dll!TBaseMulticastDelegate<void,UObject * __ptr64>::Broadcast(UObject * <Params_0>) Line 809 C++
UE4Editor-CoreUObject-Win64-Debug.dll!FCoreUObjectDelegates::BroadcastOnObjectModified(UObject * Object) Line 1715 C++
UE4Editor-CoreUObject-Win64-Debug.dll!UObject::Modify(bool bAlwaysMarkDirty) Line 849 C++
UE4Editor-Engine-Win64-Debug.dll!UActorComponent::Modify(bool bAlwaysMarkDirty) Line 447 C++
UE4Editor-Engine-Win64-Debug.dll!AActor::IncrementalRegisterComponents(int NumComponentsToRegister) Line 3614 C++
UE4Editor-Engine-Win64-Debug.dll!AActor::RegisterAllComponents() Line 3566 C++
UE4Editor-Engine-Win64-Debug.dll!AActor::PostSpawnInitialize(const FTransform & UserSpawnTransform, AActor * InOwner, APawn * InInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction) Line 2508 C++
UE4Editor-Engine-Win64-Debug.dll!UWorld::SpawnActor(UClass * Class, const FTransform * UserTransformPtr, const FActorSpawnParameters & SpawnParameters) Line 430 C++
UE4Editor-Engine-Win64-Debug.dll!UWorld::SpawnActor(UClass * Class, const FVector * Location, const FRotator * Rotation, const FActorSpawnParameters & SpawnParameters) Line 267 C++
UE4Editor-hyperspace-Win64-Debug.dll!AHSPlayerController::HandleCrashTest(AActor * Actor) Line 49 C++
This is quite specific, but my main base actor in my game derives from StaticMeshActor. Any workaround would be fully appreciated, otherwise I am stuck to 4.7 and/or need to rework a large part of my code base and assets. Thanks!