Download

Setting Animation Blueprint in Constructor

Found the solution, I needed to include some things
#include “Animation/AnimBlueprint.h”
#include “Animation/AnimBlueprintGeneratedClass.h”

Hey all,

Using 4.7.3 here.

I’m currently setting up our character controller and trying to assign an animation blueprint.

After following information in this thread (https://forums.unrealengine.com/showthread.php?12980-Animation-not-playing-after-AnimBP-assigned-via-c), I’m encountering issues.

When compiling I get the error


Error	1	error C2664: 'void ConstructorHelpers::ValidateObject(UObject *,const FString &,const TCHAR *)' : cannot convert argument 1 from 'UAnimBlueprintGeneratedClass *' to 'UObject *'	C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h	92	1



Here’s the code I’m using so you don’t have to follow the link above:



static ConstructorHelpers::FObjectFinder<UAnimBlueprintGeneratedClass> MeshAnimClass(TEXT("AnimBlueprintGeneratedClass'/Game/Creatures/SkeletalMesh/Player_Character/Player_AnimBP.Player_AnimBP_C'"));
	dwarfSkeletalMesh->AnimBlueprintGeneratedClass = MeshAnimClass.Object;



If anyone could help that would be great

Thanks,

Andrew.

The only difference I can see with your code is dwarfSkeletalMesh->
I’ve tested it with using Mesh-> and it works.

Which version of the engine are you using?

I’m on 4.7.3 and even if I use Mesh-> it gives the same error listed above.

Yeah 4.7.3, sorry i’m kinda lost as to why it’s not working. I think somebody else might have a better idea. Ill think on it for awhile.

Found the solution, was missing some includes:
#include “Animation/AnimBlueprint.h”
#include “Animation/AnimBlueprintGeneratedClass.h”