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"

How / Where to store data?

Where can I / how should I store arbitrary data? Seems simple enough but I'm having trouble finding anything online. Examples of things I would want to store are a 2d array for a grid map's contents, various attributes etc that could be easily called anywhere, like during level creation to place appropriate actors as necessary based on said stored data.

Product Version: UE 4.22
Tags:
more ▼

asked Jun 12 '19 at 01:13 PM in Blueprint Scripting

avatar image

Mihhhhhhhh
11 2 2 3

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

1 answer: sort voted first

Game Instance - it persists even if you change levels and is a framework class, accessible globally. Alternatively, you can use a Save Game Object and load / save data to it. Consider looking into structs for extra flexibility / automation.

more ▼

answered Jun 12 '19 at 01:35 PM

avatar image

Everynone
15.2k 77 25 62

avatar image Mihhhhhhhh Jun 15 '19 at 06:44 PM

I have been reading up on game instance-class but I can't figure out how to store anything more complicated than a single string, value or a boolean. I came across Data Tables but according to what I can find on google, those are not meant to be edited outside the editor nor are even properly supported with blueprints. Is there a proper way to store a table of data or do I have to botch it together by holding all of the data in a string that contains some character or
to read specific parts during runtime?

avatar image Everynone Jun 15 '19 at 07:51 PM

Create arrays, look into structs - they're collections of variables. You can nest struct arrays inside other arrays to store any amount of variables. Look into save games objects. You will need to save your game eventually, structs are pretty much a must here as well - that's unless you want to use external plugins.

Data Tables are read-only.

Is there a proper way to store a table of data or do I have to botch it together by holding all of the data in a string that contains some character or to read specific parts during runtime?

Again - structs.

avatar image Everynone Jun 15 '19 at 08:00 PM

As an example:

alt text

A struct holding 30 or so other variables, last one is another struct that holds just material information of this object.

Data Tables also use them, so you can load a struct from a DT - a template data for an object, construct the object based on the pulled data, modify the data and then save it using the very same struct. Not back into a Data Table, though - save in the game instance if it's temporary / transitional data to be stored during a session, or save into a save game object if it needs to truly persist - be loaded next time the game is launched.

capture.png (85.3 kB)
(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