Description

When a PlayerController or any actor with bDeferConstruction set to true is spawned, OnActorSpawned.Broadcast is called prior to FinishSpawning which can cause issues as some components may not be initialized.

Regression?: No
This occurs in 4.16

Steps to Reproduce
  1. Download the attached project.
  2. Generate project files and open the .sln.
  3. Start the project in Debug (Right-click on the DeferTest module and select "Debug > Start new instance".)
  4. In Visual Studio, set a Breakpoint on OnActorSpawned.Broadcast(Actor); in LevelActor.cpp (Line# 468 in 4.16) and on void AActor::FinishSpawning in Actor.cpp (Line# 2831 in 4.16.)
  5. Press Play in the editor to start PIE. The breakpoints will be triggered.
  6. Pay attention to the "This" field in the "Autos" window at the bottom of Visual Studio (default layout) when FinishSpawning is the current breakpoint to see the name of the asset that has finished spawning.
  7. Pay attention to the "Actor" field when looking at OnActorSpawned.Broadcast.
  8. By clicking "Continue", continue through the assets until you see either PlayerController appear in the fields mentioned above and then for Actor (the one we are spawning with bDeferConstruction.)
    Result: OnActorSpawned.Broadcast is called prior to FinishSpawning for the PlayerController and for Actor.
    Expected: FinishSpawning is called prior to OnActorSpawned.Broadcast for both the PlayerController and Actor, as with all other actors.

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-51158 in the post.

0
Login to Vote

Unresolved
ComponentGameplay - Core
Affects Versions4.164.174.184.19
CreatedOct 12, 2017
UpdatedOct 13, 2017