Casting to MyCharacterBP is failing why?

I am casting to my main character “MyCharacterBP” from an AIControllerBP. but its failing every time.
i am using " get player controller > cast to MyCharacterBP " node setup? what is the right setup to cast to my character ??

And please someone explain casting… and why it fails… cuz 90% time i stuck its because of casting fails!!

Try “Get Player Pawn”.

And the reason your casts are failing is because you have to reference correctly

For example, if you were to cast to PlayerController, you would “Get Player Controller”.

If you were to cast to PlayerState, you would “Get Player State”.

Simple!

its still not working i tried "get player pawn > and then cast to mycharacterBP
still fails…

Actually sorry it worked! :slight_smile: i didnt know that the AIController has to be in game in order for it to work. once i spawned it. it worked thanks a ton! :slight_smile: :slight_smile:

Same thing :slight_smile:

Cast to MyAIController, reference “Get Player Controller”

BTW… what if i want to cast to MyAIController in characterBP … ?? its still so much confusing… what is the correct way??
I am using “get AIController > cast to MyAIController”
(CharacterBP is also getting controlled by MyAIController, so basically casting to its own controller!)

Definitely not working this time…
note: i’m playing as AI Character while casting for its controller…

Here it is…
maybe its not working because i possessed this character!

okay its like this…
i start game > possess an AIcharacter which was earlier getting controlled by AIcontroller…
now as i am controlling the AIcharacter i want to cast to its AIcontroller to change its behavior tree…

Can you show me a screenshot?

Hmm… So you’re using the AIController for the movement of yourself?

Not really sure what you’re trying to do exactly

yes… but how… ?

Thats the problem… plugging “Get AI Controller” node before casting is not working…

Well what else have you tried?

Perhaps the issue is the AIController is getting overwritten when you possess it… In that case, be sure to set the controller in a variable before you possess it, and use that to cast to your AIController.

okay i’ll try that… thanks!

Oh I see, yeah in that case Get Player Controller won’t work, you have to reference that AIs controller instead

I think it’s “Get AIController” :stuck_out_tongue:

Yep, I just did it. I works.

GL!

can you post the node setup if possible that will be big help :slight_smile: