Description

If a UPaperSpriteComponent is declared in a Scene Component class and the Scene Component is added as a component to a Pawn class, creating a blueprint of the Pawn and setting the Paper Sprite causes the asset set to be lost when the blueprint is compiled.

Steps to Reproduce
  1. Open UE4 Editor (2D Side Scroller template)
  2. Add class based on Scene Component (MySceneComp)
  3. Add the following to MySceneComp.h
    • Place above .genereated.h include
      #include "PaperSpriteComponent.h"
      
    • Add to the class body
      	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
      		UPaperSpriteComponent* MySprite;
      
  4. Add the following to MySceneComp.cpp in the constructor
    MySprite = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("MySprite"));
    
  5. Add code based on Pawn (MyPawn)
  6. Add the following to MyPawn.h
    	UPROPERTY(EditAnywhere, BlueprintReadOnly)
    		USceneComponent* RootSceneComponent;
    
    	UPROPERTY(EditAnywhere, BlueprintReadOnly)
    	class UMySceneComp* MyComponent;
    
  7. Add the following to MyPawn.cpp
    • Add to the top of the file with other includes:
      #include "MySceneComp.h"
      
    • Add to constructor:
      	RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
      	RootComponent = RootSceneComponent;
      	MyComponent = CreateDefaultSubobject<UMySceneComponent>(TEXT("MyComponent"));
      
  8. Compile
  9. Create a blueprint of MyPawn (MyPawnBP)
  10. Select MyComponent in the Component hierarchy
  11. Search for Source Sprite in the details panel and set the asset to Background_Sprite
  12. Compile blueprint

Result:
The Background sprite disappears from the viewport and must be removed / readded

Expected:
Compiling blueprint retains reference to set asset.

Have Comments or More Details?

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

3
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.13
CreatedSep 8, 2016
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue