Setting a FActorSpawnParameters' variable's Template to "this" and then spawning an instance of the static mesh actor using the parameter causes the editor to crash.
1. Open UE4Editor (any project)
2. Add code to project based on StaticMeshActor (MyStaticMesh)
3. Add the following to the header file
virtual void BeginPlay() { static bool bSpawnedClone = false; if (!bSpawnedClone) { bSpawnedClone = true; FActorSpawnParameters Params; Params.Template = this; ACrashActor* Clone = GetWorld()->SpawnActor<ACrashActor>(GetClass(), Params); } }
4. Compile the code
5. Add instance of MyStaticMesh to the level and PIE
Result:
Editor will close immediately
Expected:
A copy of the actor placed in the level is spawned.
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay |
---|---|
Affects Versions | 4.9 |
Target Fix | 4.9.1 |
Created | Sep 10, 2015 |
---|---|
Resolved | Sep 21, 2015 |
Updated | Apr 27, 2018 |