Traditionally if using Data table
(if many assets, gonna create many rows resulting in heavy load)
Create a Structure (name as F Rerouce), and a data table (, choose FRrsource as a structure give to data table, name as Resources_DT)
Input wanted data in:
If using Data Asset, create a BP class as a Strcuture):
Create a folder called DataAsset
In BP class, type Primary DataAsset
Create and name as ResourceDataAsset
Add variables that are equivalent to Structure command
(Use DataAsset advantage over Strutcure: can also add Functions and Event Dispatcher)
e.g. Create a new function to Set a Discount New Sell cost by BP:
Tick Pure in Functions Detail
Create DataAsset to connect to Primary Data Asset:
Now R click and go to Miscellaneous → Data Assets
Choose ResourceDataAsset just created e.g Name as Flower (as 1 of the asset)
Fill in follow info
Duplicate the Asset and rename it (e.g. mushroom), open the asset and change its mesh, name, description, etc
Create a BP actor called Item, add a static mesh component
Add a variable called Data, choose Resource Data Asset
After complie, can choose the asset in default value:
Tick box Instance Editable, Go to construction script, set as follow:
Drag the Actor in scene, choose the asset in Default Data
Optional (not fully undetstood)
If to make a character doing inventory resource:
Open 1st/3rd person BP, add an inventory variable and select follow variable Types:
Make the follow graph, choose assets from the Add node (it’s read only, can’t change any data inside data asset)
But can set the player do some functions, e.g. Sell items
Create a new function called Sell Item, add Item in input, then drag the node to connect Get Discounted Sell cost function (created earlier on)
Set the factor as 0.9 (i.e. 10% off), then extend the node logic to let character gives money out