The problem is that i have no idea how to actually do this. The code above was just an idea. But I don’t know what variable to use for the sprite and how to initialize it so I could place it as an actual actor in my level.
You can create a custom class, derived from Paper Sprite Component or Paper Sprite Actor from the editor just like any other class. However, please keep in mind that these classes come from Paper2D module, which may not be included to your project by default. To include it, please do the following:
Go to Build.cs file of your project (YourProjectName\Source\ YourProjectName\ YourProjectName.Build.cs).
In the file, find PublicDependencyModuleNames.AddRange command and add Paper2D to the list of included modules:
That wasn’t quite what I was hoping for. Couldn’t I just attach the sprite like a mesh or an audio source to my class (derived from APawn)? I mean it works in blueprints where I can simply drag a sprite into the components view.