x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

SpawnActor crashing with Access violation - code c0000005 (first/second chance not available

I am experiencing a crash when trying to spawn an actor with GetWorld()->SpawnActor from an existing actor in the level.

I have an actor named AVoxWorld that I would like to spawn chunk actors when the world is dragged into the editor.

 void AVoxWorld::PostInitProperties()
 {
     Super::PostInitProperties();
     GenerateWorld();
 }

 void AVoxWorld::GenerateWorld()
 {
     GetWorld()->SpawnActor<AChunk>(FVector(0, 0, 0), FRotator::ZeroRotator);
 }

and my AChunk class is just an unmodified actor template:

 AChunk::AChunk()
 {
      // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
     PrimaryActorTick.bCanEverTick = false;
 }

When I drag the world into the editor, I receive the following error:

 Access violation - code c0000005 (first/second chance not available)
 
 UE4Editor_Engine!UWorld::SpawnActor() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\engine\private\levelactor.cpp:278]
 UE4Editor_Engine!UWorld::SpawnActor() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\engine\private\levelactor.cpp:271]
 UE4Editor_SP_Voxel_8643!AVoxWorld::GenerateWorld() [c:\users\andrew\documents\unreal projects\sp_voxel\source\sp_voxel\voxworld.cpp:43]
 UE4Editor_CoreUObject!FObjectInitializer::PostConstructInit() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:2772]
 UE4Editor_CoreUObject!FObjectInitializer::~FObjectInitializer() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:2629]
 UE4Editor_HotReload!FHotReloadClassReinstancer::ReconstructClassDefaultObject() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:208]
 UE4Editor_HotReload!FHotReloadClassReinstancer::RecreateCDOAndSetupOldClassReinstancing() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:243]
 UE4Editor_HotReload!FHotReloadClassReinstancer::FHotReloadClassReinstancer() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.cpp:316]
 UE4Editor_HotReload!FHotReloadClassReinstancer::Create() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreloadclassreinstancer.h:114]
 UE4Editor_HotReload!FHotReloadModule::ReinstanceClass() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1228]
 UE4Editor_HotReload!FHotReloadModule::ReinstanceClasses() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1219]
 UE4Editor_HotReload!TBaseRawMethodDelegateInstance<0,FHotReloadModule,void __cdecl(void)>::ExecuteIfSafe() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:638]
 UE4Editor_CoreUObject!UClassReplaceHotReloadClasses() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:688]
 UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:835]
 UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void __cdecl(void)>::ExecuteIfSafe() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\public\delegates\delegateinstancesimpl.h:1017]
 UE4Editor_Core!TBaseMulticastDelegate<void>::Broadcast() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\public\delegates\delegatesignatureimpl.inl:921]
 UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:461]
 UE4Editor_Core!FModuleManager::LoadModule() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\private\modules\modulemanager.cpp:322]
 UE4Editor_HotReload!FHotReloadModule::DoHotReloadInternal() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:828]
 UE4Editor_HotReload!UE4Function_Private::TFunctionRefCaller<<lambda_845f9b2944b03bbc30be1e1f4a8d7f4b>,void __cdecl(TMap<FString,FString,FDefaultSetAllocator,TDefaultMapKeyFuncs<FString,FString,0> > const & __ptr64,bool,enum ECompilationResult::Type)>::Call() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\public\templates\function.h:246]
 UE4Editor_HotReload!FHotReloadModule::CheckForFinishedModuleDLLCompile() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:1877]
 UE4Editor_HotReload!FHotReloadModule::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\developer\hotreload\private\hotreload.cpp:566]
 UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1020]
 UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:371]
 UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2834]
 UE4Editor!GuardedMain() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\launch.cpp:156]
 UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
 UE4Editor!WinMain() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
 UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
 kernel32
 ntdll

I should note a couple of things:

  1. I'm using PostInitProperties so that I can preview the world generation in the editor. I may switch to OnConstruction in the future but this is probably out of the scope of this question.

  2. I have tried putting the call to GenerateWorld() into BeginPlay(), and it crashes as soon as I hit play with the same error.

Thanks for your help in advance!

Product Version: UE 4.13
Tags:
more ▼

asked Dec 19 '16 at 07:31 PM in Using UE4

avatar image

staringatlights
11 1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question