Use of undefined type 'UAnimInstance'

.h file:

UAnimationAsset* AnimationAsset;

class USkeletalMeshComponent* RoleMesh;

.cpp file:

RoleMesh->GetAnimInstance()->PlaySlotAnimationAsDynamicMontage(AnimationAsset, “entity”);

i got this ‘use of undefined type ‘UAnimInstance’’ when i compile it in 4.13, there is no problom before this version. what i can do?

Hey heartstone-

Did you add an include statement for the AnimInstance class? If you add `#include " Runtime/Engine/Classes/Animation/AnimationAsset.h" at the top of the .h file you should be able to compile the code.


Doug Wilson

I think you meant:

#include "Runtime/Engine/Classes/Animation/AnimInstance.h"

yes, it worked !!

jup he meant that

Tip for finding imports:
Go into the solution explorer and search for the unrecognized classname.

IF you find it, then all you have to do is:

Then start typing the import, looking at the suggestions and comparing to the folder structure you see
in the solution explorer.

For me, all my imports needed to be in the format:

#include "…/Relative/Path/To/WhateverClass.h"