Download

Using Paper2D in code

I’m trying to use the Paper2D flipbook stuff in code instead of blueprints and I’m running across a few problems that I need some help with.

I’ve made an actor component that contains a few UPaperFlipbooks and a reference to a UPaperAnimatedRenderComponent which belongs to a character. I want my component to be able to look at what the character is doing and play the relevant flipbook animation (idle, run, jump, etc), and optionally override it with another flipbook (such as a combat attack).

Firstly, I’ve put PrivateDependencyModuleNames.Add(“Paper2D”); in MyGame.Build.cs, which allows me to compile in Development Editor mode but not DebugGame Editor. That gives me the following error:
LINK : fatal error LNK1181: cannot open input file ‘C:\UE4\Unreal Engine\4.2\Engine\Plugins\Experimental\Paper2D\Intermediate/Build/Win64\Dynamic\UE4Editor\DebugGame\UE4Editor-Paper2D.lib’
I’m using the unmodified 4.2.1 engine (and currently downloading the 4.3 preview in case that fixes anything). Isn’t DebugGame supposed to use the Development version of the engine libs? Why isn’t it doing that here? It worked back when I was using the 4.1 version of the engine.

Secondly, when I try running the editor (Development Editor), I get an error message pop up that says “The program can’t start because UE4Editor-Paper2D.dll is missing from your computer” (again, not something that happened when I was using 4.1). And I do have that file in the 4.2 Paper2D binaries folder, so how is it not finding it?

Finally, I’ve been trying to call the SetCurrentTime function on the UPaperAnimatedRenderComponent, because back when I had it working in 4.1 I noticed that when I set the flipbook to play an attack, it would just continue from where it currently was through the flipbook instead of starting from the beginning. Only it won’t compile if I do that because it apparently can’t find the function. I’ve tried out a few of the other functions and it looks like I can call the virtual ones but not the non-virtual ones. Is that a problem caused by the MinimalAPI keyword? Is there a way of getting it to do what I want?

Hi Stormharrier,

I think most/all of these issues should be resolved in 4.3 which was released today.

  • Various issues with C++ game code depending on plugin modules were resolved (not sure of the details, I can ask Ben if he knows the specific changelists if you need them)
  • UPaperFlipbookComponent (renamed from UPaperAnimatedRenderComponent) is now fully DLL exported instead of MinimalAPI, and has a much meatier interface allowing more control over the playing flipbook. Calling SetFlipbook with the same animation again won’t reset it, but you can then call PlayFromStart or SetPlaybackPosition after calling SetFlipbook if you want to force it to restart.

Give that a go and let me know if you’re still having any problems or notice anything else that needs to be DLL exported.

Cheers,
Michael Noland