Custom item or class database
I'm looking to create a database that contains all the data I need for constructing certain gameplay elements at runtime. Preferably editable via a blueprint, for easy access and changes.
I have a Weapons and when the weapon is equipped I can query my item database and access the properties of the weapon.
I tried to create a Database class that held a TArray of my ItemData class. Then creating a Blueprint of the class.
The theory being, that I could have an array of my data class, then populate the array with all the data and references, such as, meshes and particles systems as needed. However, it seems you cannot have a TArray of classes.
So then I tried creating a Struct for my ItemData and using a TArray of those, but that also seems you cannot populate a struct with a TSubobjectPtr. If you do it crashes the editor.
So my questions is how would I go about setting up some kind of database as described? Or is there something I am missing?
asked Jun 25 '14 at 05:00 AM in C++ Programming
I did some more digging around and found FStringAssetReference and TAssetPtr to be the answer to my issues.
Here is the documentation: https://docs.unrealengine.com/latest/INT/Programming/Assets/AsyncLoading/index.html
and here is a great tutorial someone did on the forums: https://forums.unrealengine.com/showthread.php?5309-TUTORIAL-C-Runtime-Async-Load-Modular-Character-(Intermediate)
answered Jun 26 '14 at 01:10 AM
What are you trying to use TSubobjectPtr for in the structure? TSubobjectPtrs are meant to point at actor sub-object, as name says as well. It should not be used anywhere outside of the actor.
Just hold asset references in your structure.
answered Jun 25 '14 at 09:43 PM
Have you tried SQLite? I've gotten it to integrate pretty well with unreal.
answered Jun 25 '14 at 09:58 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here