Description

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.

Steps to Reproduce

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.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Cannot Reproduce
ComponentUE - Gameplay
Affects Versions4.9
Target Fix4.9.1
CreatedSep 10, 2015
ResolvedSep 21, 2015
UpdatedApr 27, 2018