x

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"

C++: Easy way to save a structure.

Hi. I'd like to save an array of structures from my player controller to a save game class. I could easely save other types of variables, because you can just create a variable and then transfer it. But if I create the exact same structure in the save game class, I can't pass over the struct. So do I have to break the struct up and send every variable alone? Because my struct is pretty big and so I'd like to have an other option. Thanks!

Product Version: Not Selected
Tags:
more ▼

asked Aug 27 '18 at 08:36 PM in C++ Programming

avatar image

Aneos
25 3 4 10

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

1 answer: sort voted first

You don't need to declare 2nd identical structure, just forward reference (put struct before the type) the structure in save game class and UHT and UE4 reflection system will know which structure you use, you will only need to include deceleration in cpp file when you gonna copy the data so compiler will know which structure you use, but you need to do it anyway.

more ▼

answered Aug 27 '18 at 10:12 PM

avatar image

Shadowriver
37.2k 936 172 1116

avatar image Aneos Aug 28 '18 at 04:56 PM

Thx for the reply. But could you pls give me an example? forward reference (put struct before the type) the structure I didn't really get this part. How do I forward reference the structure?

avatar image Aneos Aug 31 '18 at 05:27 PM

I tried it now many times and I don't think I can get a solution. Could you pls send me an example?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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