# 2D animation ConstructorStatics error

**URL:** <https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160>\
**Category:** Character & Animation\
**Tags:** bug, unreal-engine, CPP, question\
**Created:** [December 13, 2017, 2:23pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160 "2017-12-13T14:23:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiverFictionB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DiverFictionB](https://forums.unrealengine.com/u/DiverFictionB)\
**Post date:** [December 13, 2017, 2:23pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/1 "2017-12-13T14:23:26Z")

</div>

Hello everyone

I’m having a trouble setting 2D flipbook animation into C++, this problem wasn’t there in the past.  
I used to do this method without any problems but now when I do  
header:

```
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FlipbookComponent", meta = (AllowPrivateAccess = "true"))
		class UPaperFlipbookComponent * paperComponent;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FlipbookComponent", meta = (AllowPrivateAccess = "true"))
		class UPaperFlipbook* paperSoPWalk;

```

Cpp:  
struct FConstructorStatics  
{  
ConstructorHelpers::FObjectFinderOptional paperSoPWalkAsset;

```
	FConstructorStatics()
		: paperSoPWalkAsset(TEXT("PaperFlipbook'/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation'"))
	{
	}
};
static FConstructorStatics ConstructorStatics;
paperSoPWalk = ConstructorStatics.paperSoPWalkAsset.Get();

```

gives me bugs  
apparely the problem coming from this line  
paperSoPWalk = ConstructorStatics.paperSoPWalkAsset.Get();

 ![223626-cpp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/9/5/6954e0757ecc6e644d7e23132b31ee72f5cea451.jpeg)

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 13, 2017, 3:43pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/2 "2017-12-13T15:43:48Z")

</div>

It’s a compiler error so you need to check the syntax, usually what i do is:

```
static ConstructorHelpers::FObjectFinder<UClass> PlayerPawnObject(TEXT("/Game/Characters/Scavenger/Player_BP.Player_BP_C"));

	if (PlayerPawnObject.Object)
		DefaultPawnClass = PlayerPawnObject.Object;

```

So in your case you can try:

```
    static ConstructorHelpers::FObjectFinder<UPaperFlipbook> PaperFlipbookObject(TEXT("/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation")); // If this doesnt work try with "/Game/2DSideScroller/Sprites/RunningAnimation"
    
    	if (PaperFlipbookObject.Object)
    		Class = PaperFlipbookObject.Object;
```

---

<div class="post-metadata">

**Author:** ![DiverFictionB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DiverFictionB](https://forums.unrealengine.com/u/DiverFictionB)\
**Post date:** [December 13, 2017, 7:14pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/3 "2017-12-13T19:14:32Z")

</div>

Hi, thank you for your response

It didn’t work

 ![223672-question.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/b/0db82c7ac93501734532acd49f010ed9ef86bc2c.jpeg)

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 13, 2017, 9:36pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/4 "2017-12-13T21:36:01Z")

</div>

The screenshot doesn’t help, disable the warnings and show only the errors.

---

<div class="post-metadata">

**Author:** ![DiverFictionB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DiverFictionB](https://forums.unrealengine.com/u/DiverFictionB)\
**Post date:** [December 14, 2017, 1:59am UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/5 "2017-12-14T01:59:49Z")

</div>

these are the errors  
three of them

\*\*\*Severity Code Description Project File Line Suppression State  
Error C2664 ‘void ConstructorHelpers::ValidateObject(UObject \*,const FString &,const TCHAR \*)’: cannot convert argument 1 from ‘UPaperFlipbook \*’ to ‘UObject \*’ ManSide3 E:\Program Files\Epic Games\UE\_4.18\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h 109   
Severity Code Description Project File Line Suppression State  
Error Failed to produce item: ManSide3 1

Severity Code Description Project File Line Suppression State  
Error MSB3075 The command ““E:\Program Files\Epic Games\UE\_4.18\Engine\Build\BatchFiles\Build.bat” ManSide3Editor Win64 Development " -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command. ManSide3 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 41\*\*\*

And the previous code that I used and the one that you suggested me to try:

```
Cpp:
	struct FConstructorStatics
	{
		  ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> RunningAnimAsset;
	FConstructorStatics()
		: RunningAnimAsset(TEXT("PaperFlipbook'/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation'"))
		{
		}
	};
	static FConstructorStatics ConstructorStatics; 
	RunningAnim = ConstructorStatics.RunningAnimAsset.Get();

Cpp:
		static ConstructorHelpers::FObjectFinder<UPaperFlipbook> PaperFlipbookObject
		(TEXT("PaperFlipbook'/Game/2DSideScroller/Sprites/RunningAnimation.RunningAnimation'"));

	if (PaperFlipbookObject.Object)
		Class = PaperFlipbookObject.Object;

```

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 14, 2017, 10:26am UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/6 "2017-12-14T10:26:18Z")

</div>

Have you included the PaperFlipbook header and added the Paper2D Module?

> **[Paper 2D C++: Cannot Open Source PaperCharacter.generated.h](https://forums.unrealengine.com/questions/150461/paper-2d-c-cannot-open-source-papercharactergenera.html)**
>
> So I've been trying to mess around with paper 2D, just to get some experience with it, and I have run into several problems trying to write gameplay in C++ using the plugin. At first I ran into trouble with VS not recognizing "#include...

---

<div class="post-metadata">

**Author:** ![DiverFictionB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DiverFictionB](https://forums.unrealengine.com/u/DiverFictionB)\
**Post date:** [December 14, 2017, 9:19pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/7 "2017-12-14T21:19:54Z")

</div>

I thought “PaperFlipbookComponent.h” was enough, like the previous versions of UE4.  
I never thought the missing “PaperFlipbook.h” could be the problem.  
Thank you so much man, I have been trying to solve this problem for days :).

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 14, 2017, 11:02pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/8 "2017-12-14T23:02:59Z")

</div>

Good to know, if it worked and you liked my help please upvote and mark my answer as correct 🙂

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 14, 2017, 11:37pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/9 "2017-12-14T23:37:45Z")

</div>

I meant my answer 😃 I’ll create one so you can mark it as correct.

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 14, 2017, 11:38pm UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/10 "2017-12-14T23:38:31Z")

</div>

Make sure you include “Paper2D” module and include “PaperFlipbook.h”.

---

<div class="post-metadata">

**Author:** ![DiverFictionB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DiverFictionB](https://forums.unrealengine.com/u/DiverFictionB)\
**Post date:** [December 15, 2017, 12:41am UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/11 "2017-12-15T00:41:06Z")

</div>

Sorry, I’m new to this site :). still learning

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 15, 2017, 12:42am UTC](https://forums.unrealengine.com/t/2d-animation-constructorstatics-error/412160/12 "2017-12-15T00:42:17Z")

</div>

No problem 🙂
