Edit Data table rows during gameplay - Blueprints
So I'm just starting to work with Data tables and so far I've really liked the flexibility of it for sourcing data. However, I've come to a bit of a wall in regards to setting the data in a defined row.
The way I currently have the data table is one of the fields is an int, and depending on what that int is, it changes the color of some text. It works perfectly when I pre-define what that number is, but I need to be able to change that value during gameplay, and save it too.
Is this currently possible?
Thank you for your request. I have entered a feature request, UE-21490, to be considered by the development staff.
answered Sep 25 '15 at 03:14 PM
I think its possible. But it would not work (crashes) if you plan package game for publish (PSN, Steam, AppStore, GooglePlay) bcoz of datatable asset no has access to write in final packaged game. its static data as well as any another asset in packaged project. I know some windows-people think like "ok i just write to file" but in theory YES its possible on develop project stage (around Engine pipeline) only. And NO in practice if looks wider on all platforms (os platforms and privileges on end user device/OS).
Just simple example - game started from DVD or another rom and game no has ability to check self for permissions (just no has checking procedure for app, some OS/Consoles strict that calls)? What does engine could be in that case? You lucky if app will continue with just buggy/laggy or glitches but in most of cases it will be CRASHED :D Bcoz your "smart" code want to do something in image/rom or like malware style actions...
Every OS provide user app folder - special shared folder for write/delete files or another DLC stuff of that app ("app cache" or "app data" depend of OS). So developers use that special "user app data" folder for writing some stuff (specially for support gameplay writable stuff like SAVEGAME files etc.) which would be work on every platform. On most of platforms the packaged app can't change self (write/change, in executable folder of app) for security reasons like on X based systems (iOS/Linux/Android/OSX/PS). And i know windows users doesn't care and doesn't understood bocz usually in windows default user is admin's privilege user and can to do anything with all files in system (maybe in latest windows8/10 security politics changed but the same way)...
in 2 and 3 cases you can inherit DataTable class and write your own code for create/save/change data in that asset type and use "app data folder" for that operations, checking how it works in EngineEditor stage or PIE stage or run in realtime packaged game stage.
And be care - PIE (play in editor) and packaged game (cooked) not same runtime and you must to know how it works in complex for debug your own engine module in Editor and Runtime (PIE/package).
There is also the approach of using an Array or Map (Which allows for a custom ID, ie Key type) and place that in a Global variable like the GameInstance or the GameState. This is what I am currently using in one of my games, to store data about certain items, the Key is the Item's class (which means I can easily retrieve data at runtime using classes) and the Value is a Struct that defines said item. I can easily access the Map, can use it for saving and loading, and for pre-defining data.
Basically a Map where: Map
EDIT: Oups, sorry for posting on an old question.
Follow this question
Once you sign in you will be able to subscribe for any updates here