I have been trying without success to create a Sprite Component in the constructor of another component and call setsprite on it. Like this:
UAPPaperTilesetAnimationComponent::UAPPaperTilesetAnimationComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
AnimationIndex = 0;
FString ComponentName = GetName().Append("Renderer");
RenderComponent = CreateDefaultSubobject<UPaperSpriteComponent>(*ComponentName);
// This crashes
RenderComponent->SetSprite(AnimationSprite);
}
What am I missing? Any documentation or tutorial that explains how to do this exactly? Thank you.