Lets say I have a DataTable Items that store some items and its details, that currently assign in editor in an Actor.
I have another Actor also want to access this DataTable for different purpose.
What is the best way to store and share Items between classes. And I’m trying to avoid hardcoded Items asset path in C++ code, hence assigning it in editor in the first Actor
I usually used soft reference to share data with DataTable but you will need to add some check if it currently loading or not in some situation. Loading a texture image icon for example can be done in the background (don’t need it immediately) , am not sure for cpp, but it should usually be in async load asset for this.
For something ‘centralised’ like this, you may want to have an Items Subsystem. Then everything that wants to access Items, will access it via this Subsystem.
The Subsystem will still a reference to the Data Asset, but it’s going to only be a single reference for your entire game.
Game Instance Subsystem sounds sufficient in this case, but in many other cases, you will typically want a World Subsystem.
Additionally, depending on how many Items you have and how much data each Item consumes, you may want to consider using Data Assets instead of a Data Table for your Items. Data Assets can be streamed in and out on a per-item basis, whereas as a Data Table must be fully loaded.
I ended up using a combination of Asset Manager and World Subsystem instance
I haven’t tried using Data Assets and Soft Ref yet, but sound like a great idea as I read Asset Manager support scaning individual assets rather load all into a Data Table.
On a seperate note, anyone know how to check for all the running Subsystems? As in visual see them in Editor? The problem I’m thinking of is if I download a prexisting project from someone, how do I tell if they are running which Subsystem and in which mode, without having to look into each Cpp file