How can I switch between pawns during gameplay?

Hello Prompt please. I’m in same game 5 pawns, game begins with a pawn observer I need to click mouse to select one of these pawns and move it (I did manage pawn) I realize switching to this pawn? and after movement switch to pawn second observer mouse click on this pawn? If possible, give an example, I will be very grateful! Sorry for my english :slight_smile:

1 Like

You simply make PlayerController possess new pawn on click

1 Like

Hey ,

As mentioned, easiest way to handle this is to make your Player Controller possess whichever pawn you click on. In your Character (or Pawn) Blueprint, you can do something like this:

Then, whenever you click on any instance of this pawn, Player Controller will switch to that pawn.

Hope that helps!

4 Likes

Hey. Thank you for your help. I really helped. But then when I click mouse again to return to pawn observer. Please tell me if not difficult!

Hey. Thank you for your help. I really helped. But then when I click mouse again to return to pawn observer. Please tell me if not difficult!

You can do same sort of thing but using Un Possess instead. easiest place to do this would be Level Blueprint, though there are probably more efficient ways to handle it once you get into more complex controls. Place an instance of your Observer Character in level, and reference it like this:

There are many ways you can do this, but this should help you get started.

Thank you very much. And it is possible to implement with repeated clicking on pawn?

You mean if you click Actor while it is already possessed, you want it to return to Observer? Sure, just set a Boolean variable to true when you possess pawn. Then use a Branch node off of On Clicked event to see whether pawn is currently possessed, and if so, to possess Observer pawn instead.

Hello Please tell me what I’m doing wrong does not go back to using a pawn of observer? Thanks for help!

7723-снимок+экрана+2014-06-04+в+15.48.22.png

7724-снимок+экрана+2014-06-04+в+15.48.40.png

I think part of problem you are having is that Event Actor on Released doesn’t do what you want it to. big problem though is that your MySpectator variable is only pulling MySpectator Class, and not instance of it in level. To solve this, you can use Get Player Pawn on Begin Play, and save it as a Pawn variable.

Hope that clears it up a bit.

Thank you very much! Everything works. I’m really grateful to you.

problem I have with all of this is, what if you have a C++ pawn?

That’s a question better asked in C++ section:

https://answers.unrealengine.com/spaces/23/c-programming.html

This solve my 2 days problem on unpossed!! Thank u !!! Set variable “Observer” solve it!

1 Like

8 years later I ran into a similar issue and this thread helped me solve it. Thanks!

Same here!