Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 JSON. And only structs can be converted directly to json.

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.


Product Version: UE 4.8
more ▼

asked Jul 22 '15 at 11:26 AM in C++ Programming

avatar image

23 2 5 7

avatar image Shadowriver Jul 22 '15 at 12:33 PM

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

avatar image dothem Jul 22 '15 at 12:55 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question