Datahandling: Structs or Class

Hello all

I run into a problem of my experience in c++ and unreal engine.

My scenario:

In my game, the user can create (local) multiple players, which putted in an array. The last created user will be the “activePlayer” (you can switch the activePlayer by choosing on other in the GUI). From there, the active player have a levelprogress, which stores the highscores of these players, the items, level and much more.

Now is my question, actually I have this two things (Player, LevelProgress) in structs. My savegame contains an array of Player and each player have a LevelProgress. The active player is also an Player. It would be better, if I have the activePlayer as an ID/GUID, so I can just pick thrue this out of array and edit if something changes.

When I put a propertie like GUID or ID into the Player it wont work.

There must be a better solution, then always do a “make struct” and “break struct” and save new to array or context istnt very useful.

How do you handle this data in your project (in big projects).

Structs would be nice, because I’ve a REST API with . And only structs can be converted directly to .

I come from JAVA, C# world, so for me there are Entities or DTO, which I easely can create with “new Player()” and have an instance of this object with his own data and can reference it anywhere I want with the GUID / ID.

Thanks!

Why you contain those structs in objects respocible for players, like UPlayer or UPlayerController?

Because its not really a UPlayer and not a Controller. Its not an actor, means it doesnt spawn as physical.