Thank you.
I added a pinter of the class.
But I’m stuck in moment that I can’t cast it.
I need to call exactly object that my character is using.
And I can’t figure it out the way how to find the animation instance that my character is using…
The Character class needs to know about your AnimationInstance Class. In other words you need a pointer to it. You can achieve this by for example creating the animation instance in the character class. All the creation methods, for example NewObject return a pointer to the object you just created that you can use. When you have this pointer (lets call it Animation) you can access all its public members with the → operator. So in your case you would simply write this Animation->myFunction(); to call the function.
I don’t know anything about Animation instances, so I can’t give you the perfect explanation. But: Do you Spawn/Create the animation instance in blueprint/code, or did you drag it into the level manually?
It’s my main character’s Anim instance.
So if I play, it just spawn from “player start” location.
and Anim Instance is my character’s skeletal mesh’s object.
I tried to cast or referenced but c++ gives me denying message at the compile procedure…
Not easy. I tried to find another answer but couldn’t figure it out.
If you get an access violation one the MyAnim->f_DeltaTime = 0.3f line, that means that MyAnim is a nullptr. That can mean two things: Either the GetAnimInstance() returns a nullptr, which means there is no anim instance (yet?, maybe you make this call, before the instance gets assigned?), or the cast fails and returns nullptr, which would mean that GetAnimInstance() does not return an object that is a UMyAnim
Thank you! I’ve solved this problem.
I just made a function for casting and if there is no class pointer or no animation instance, I just simply returned the function.
and few ticks later, it has casted class and assigned an anim instance.
So it’s clearly working well. Thank you!