How to define a pawn owner on pawn spawn?

Hi!

I’m building an RTS like game and I’ve run into some struggeling.

I want to place a building which spawns pawns. For singleplayer, no problem.

Now I want to add multiple players and this question came up: how to know, who owns which pawn?

My first thought was to add a PlayerID property to all buildings (Actors) and units (Pawns) and copy playercontroller->player state->player id into that.

Is this the right approach or is there already a better way in UE4 to differentiate between which player controlls which pawns/actors?

Also please keep in mind, in the future, AI controlled players should be possible (have their own Player ID).

C++/Blueprint is both ok.

Thanks!

Maybe this link helps? Set the Actors Owner in C++ - Programming & Scripting - Unreal Engine Forums but probably you are looking for a different kind of “ownership”…

Not what I was searching for. The topic is hard to search/google for, as the questions/solutions like yours appear. I search for a method to define, which pawn/actor belongs to a player (faction/team?) As all my pawns are spawned by the server, the authority is not the solution.