Hello Prompt please. I’m in the same game 5 pawns, the game begins with a pawn observer I need to click the mouse to select one of these pawns and move it (I did manage pawn) I realize switching to this pawn? and after the movement switch to pawn the second observer mouse click on this pawn? If possible, give an example, I will be very grateful! Sorry for my english
Get a reference to the Player Controller and use the Possess function to switch between Pawns.
I cannt show you an example. But the idea is to select the pawn using the click event (you might want to do a ray cast depending on your game setup). Then cast it to Pawn class. The output of the Cast (if Valid) should be used with the ‘Possess’ function to gain control of that pawn.
Thank you. But I do not quite understand where these settings should be applied or it is done in the game mode or the player control? This applies construction script or event graph? Help please!!!
These are not settings.
Possess is a node available in blueprint.
Ok, I am going to make an assumption that you have 5 pawns/charcters that you wish to control. YOu have one PlayerController whihc will control them (one at a time). You want to switch control when you click a Pawn.
To do this, you must have a click-event handler in your Character blueprint. When That event happens, you get a reference to your PlayerController using GetPlayerController node. Using this node and a reference to your own Charcter (using self), call the Possess node. This should effectively change the Pawn you are controlling.