# Actor successfully spawning in the editor but crashes application during PIE

**URL:** <https://forums.unrealengine.com/t/actor-successfully-spawning-in-the-editor-but-crashes-application-during-pie/488925>\
**Category:** Asset Creation\
**Tags:** graphics-programming, procedural-mesh-comp, unreal-engine, question\
**Created:** [September 20, 2021, 9:39pm UTC](https://forums.unrealengine.com/t/actor-successfully-spawning-in-the-editor-but-crashes-application-during-pie/488925 "2021-09-20T21:39:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlbyTree](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/albytree/32/88719_2.png) [@AlbyTree](https://forums.unrealengine.com/u/AlbyTree)\
**Post date:** [September 20, 2021, 9:39pm UTC](https://forums.unrealengine.com/t/actor-successfully-spawning-in-the-editor-but-crashes-application-during-pie/488925/1 "2021-09-20T21:39:21Z")

</div>

I’m creating custom meshes (a table and a chair) by using the `UProceduralMeshComponent` class.  
I defined a base class `UBasicProcMesh` that hinerits from `UProceduralMeshComponent` and stores vertices, indices, UVs and other stuff used for the geometry of a 3D object.  
Then, I defined 2 subclasses of `UBasicProcMesh`, `UTableProcMesh` and `UChairProcMesh`, which store the specific geometry of a table and a chair respectively.  
Finally, I defined 2 actors, `ATable` and `AChair`, which have an `UTableProcMesh` object and an `UChairProcMesh` object respectively.

Inside both actors, I removed the `Tick()` method and the `bCanEverTick` line and overriden `BeginPlay()`, `PostActorCreated()` and `PostLoad()`.  
These methods’s behaviours are pretty much the same for both actors (below, an example for the chair)

```
void AChair::BeginPlay()
{
	Super::BeginPlay();
	SetupMesh();
}

void AChair::PostActorCreated()
{
	Super::PostActorCreated();
	SetupMesh();
}

void AChair::PostLoad()
{
	Super::PostLoad();
	SetupMesh();
}

void AChair::SetupMesh()
{
	Chair->DrawMesh("MeshChair");
	Chair->SetWorldScale3D(ChairScale);
	RootComponent->SetWorldLocation(SceneLocation);
}
...
void UChairProcMesh::DrawMesh(FString MeshType)
{
	Vertices.Reset();
	Triangles.Reset();
	Normals.Reset();
	Tangents.Reset();
	UVs.Reset();
	Colors.Reset();

	DefineMesh(MeshType);

	this->CreateMeshSection_LinearColor(0, Vertices, Triangles, Normals, UVs, Colors, Tangents, true);
}

```

If I place a table and/or a chair in the editor, everything is okay; if I place a table and use PIE, everything is okay; if I place a chair and use PIE, I get an exception.  
If I use the `Development Editor` or the `DebugGame Editor` build I get

```
Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffff

0x00007ffa0b4f179c UE4Editor-CoreUObject.dll!StaticDuplicateObjectEx() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:2111]
0x00007ffa0b4f086f UE4Editor-CoreUObject.dll!StaticDuplicateObject() [D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:1961]
0x00007ffa04aa6ccc UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEWorldByDuplication() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:2098]
0x00007ffa06c6ae1f UE4Editor-Engine.dll!UGameInstance::InitializeForPlayInEditor() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\GameInstance.cpp:289]
0x00007ffa04aa4c5b UE4Editor-UnrealEd.dll!UEditorEngine::CreateInnerProcessPIEGameInstance() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:2652]
0x00007ffa04ac682c UE4Editor-UnrealEd.dll!UEditorEngine::OnLoginPIEComplete_Deferred() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1474]
0x00007ffa04aa6899 UE4Editor-UnrealEd.dll!UEditorEngine::CreateNewPlayInEditorInstance() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1708]
0x00007ffa04ae23da UE4Editor-UnrealEd.dll!UEditorEngine::StartPlayInEditorSession() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:2580]
0x00007ffa04ae569d UE4Editor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequestImpl() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1089]
0x00007ffa04ae5078 UE4Editor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequest() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1016]
0x00007ffa0456a854 UE4Editor-UnrealEd.dll!UEditorEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1611]
0x00007ffa04e437e6 UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:414]
0x00007ff64f447800 UE4Editor.exe!FEngineLoop::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4850]
0x00007ff64f45ba7c UE4Editor.exe!GuardedMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:169]
0x00007ff64f45bb5a UE4Editor.exe!GuardedMainWrapper() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:137]
0x00007ff64f46e31d UE4Editor.exe!WinMain() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:268]
0x00007ff64f47145a UE4Editor.exe!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
0x00007ffa67867034 KERNEL32.DLL!UnknownFunction []
0x00007ffa67da2651 ntdll.dll!UnknownFunction []

```

If I use the `DebugGame Editor` build and open UE with Visual Studio debugger sometimes I get the same exception, sometimes everything works fine.  
I tried to re-generate the Visual Studio files and re-compile but nothing changed.
