The problem with variables

Hello everyone tell me how to pass a variable from my Character C++ to AnimInstance C++.

in header file:

FString ExampleFunction(return Value);

in .cpp file:

FString ExampleFunction(return Value)
FString Value = Value; // if you using float convert it here to string
return Value;

try that

You can create new variable in AYourCharacter class UMyAnimInstance* MyAnimInstance and in BeginPlay set value of casted result of function GetMesh()->GetAnimInstance() (if you want to pass a variable into anim instance from main skeletal mesh. If not - instead GetMesh() type required mesh). After that, in any time you just call function or access variable from MyAnimInstance variable.

void AMyCharacter::BeginPlay(){
	MyAnimInstance = Cast<UMyAnimInstance>(GetMesh()->GetAnimInstance()); //set pointer to UMyAnimInstance from main character mesh

void DoSmth(bool Param){
	MyAnimInstance->bParam = Param; //set variable from your character
	MyAnimInstance->SetbParam(Param); //set variable from your character if using setter
	MyAnimInstance->DoSmth(); // call function from AnimInstance