Developer Notes

order of operation differ between package and PIE

Description

When a camera is setup in code with

GetWorld()->GetFirstPlayerController()->SetViewTarget(this);

the camera will work in the editor but a packaged version of the game has a black screen.

Steps to Reproduce

1. Open UE4 Editor (any project)
2. Create BP based on Game Mode (NewGame)
3. In World Settings, set game mode to NewGame
4. Set Default pawn to None
5. Add code to project based on actor (NewActor)
6. In constructor, add the following:

bFindCameraComponentWhenViewTarget = true;
PrimaryActorTick.bCanEverTick = true;
AutoReceiveInput = EAutoReceiveInput::Player0;

7. In Tick() function, add the following:

GetWorld()->GetFirstPlayerController()->SetViewTarget(this);

8. Compile and reopen project in the editor
9. Create BP based on NewActor
10. Add camera component to BP
11. Add instance of BP to the level then PIE
12. Create packaged version for Win64
13. After Packaging run .exe

Result:
View from step 11 will be of the BP camera while step 13 only shows a black screen.

Have Comments or More Details?

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

0
Login to Vote

Won't Fix
ComponentUE - Gameplay
Affects Versions4.6.1
CreatedFeb 19, 2015
ResolvedSep 2, 2015
UpdatedJul 14, 2021
View Jira Issue