UNREAL 5
When I try to access a variable that is in ACCharacter::MyACharacterClass from UAnimInstance::MyAnimationClass; when I put the code in NativeBeginPlay(); does not generate conflicts, but when I put the code in NativeUpdateAnimation(); Unreal Engine crashes.
The distribution of my code is: I create a global variable in the .cpp of the MyAnimationClass class;
AMyACharacterClass* variableCharacter
Inside the NativeBeginPlay();
variableCharacter= Cast(GetOwningActor());
Inside the NativeUpdateAnimation();
bool VariableAccess= CharacterVariable->DesiredVariable
In this way Unreal Crash, to place the last line in the NativeBeginPlay(); I access the variable without problem.
My need for it to be in NativeUpdateAnimation(), is to be able to update the animation that depends on that variable