I’m using the Paper2d plugin and I have multiple flipbook animations. Every time I compile I have to manually reset the animations in the UE4 editor, which is getting annoying. So, I decided I wanted to load in the flipbook animations in C++ so that I don’t ever have to do it in the editor. I read this programming guide -(https://docs.unrealengine.com/latest/INT/Programming/Assets/ReferencingAssets/) - and it said that I can use something like:
GridTexture = LoadObject<UTexture2D>(NULL, TEXT("/Engine/EngineMaterials/DefaultWhiteGrid.DefaultWhiteGrid"), NULL, LOAD_None, NULL);
However, when I changed it to fit my code for a flipbook, which looks like this:
IdleAnimation = LoadObject<UPaperFlipbook>(NULL, TEXT("/Game/2DSideScroller/Graphics/Game/Light/L_-_Idle.L_-_Idle"), NULL, LOAD_None, NULL);
I got a bunch of compiler errors. Here’s an excerpt from the log:
CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.18\Engine\Source\Runtime\CoreUObject\Public\UObject/UObjectGlobals.h(1243) : error C2027: use of undefined type 'UPaperFlipbook'
CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.18\Engine\Plugins\2D\Paper2D\Source\Paper2D\Classes\PaperFlipbookComponent.h(14) : note: see declaration of 'UPaperFlipbook'
CompilerResultsLog: Error: C:\Users\Samuel\Documents\Unreal Projects\Wavelength2 4.18\Source\Wavelength2\Wavelength2Character.cpp(33) : note: see reference to function template instantiation 'T *LoadObject<UPaperFlipbook>(UObject *,const TCHAR *,const TCHAR *,uint32,UPackageMap *)' being compiled
CompilerResultsLog: with
CompilerResultsLog: [
CompilerResultsLog: T=UPaperFlipbook
CompilerResultsLog: ]
CompilerResultsLog: Error: C:\Program Files\Epic Games\UE_4.18\Engine\Source\Runtime\CoreUObject\Public\UObject/UObjectGlobals.h(1243) : error C3861: 'StaticClass': identifier not found
CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: C:\Users\Samuel\Documents\Unreal Projects\Wavelength2 4.18\Binaries\Win64\UE4Editor-Wavelength2-1422.dll
It looks like the LoadObject function doesn’t recognize the UPaperFlipbook class, but to be honest a lot of this is going over my head. Am I doing this completely wrong or something? Any ideas as to why it’s failing?