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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

USaveGame and serializing the minimum necessary info

Got a couple questions on serialization and USaveGame

Q1

Say I have an AItem (AActor subclass) which has:

  • A gameplay 'State' property (an enum, which changes value throughout the game)

  • A 'Asset' property of type UItemAsset (UDataAsset subclass) for 'static' info on the item.

Now I want to persist this object between game sessions, including its gameplay state.

Should I create an AItem property in my USaveGame and it will automatically serialize both the 'State' and 'Asset' properties?

If so:

  • does this mean I should also manually set any other properties in the AItem to 'Transient' so they are not serialized?

  • does this mean a LOT of actor stuff will also get serialized anyway? (since AActor has a bunch of stuff in it).

Or...

Should I create an intermediate UObject, say UItem, which holds the 'State' and 'Asset' properties, have the AItem in turn have a property of this type (instead of it having the 2 properties) and in the USaveGame, create a property of type UItem instead of AItem?

Q2 In either case, for instance for the 'Asset', should I manually do something so the path to the asset is saved as opossed to the UItemAsset itself? (i.e. make a string property instead in USaveGame with the path to the asset)

Product Version: UE 4.16
Tags:
more ▼

asked Jul 30 '17 at 10:12 PM in C++ Programming

avatar image

saldavonschwartz
157 16 19 35

(comments are locked)
10|2000 characters needed characters left

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