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 to reference an asset from data table in Blueprints?

I've found THIS and THIS, but both tutorials are for C++. Is it possible to, for example, read a path of an asset from data table (csv) and spawn it via Spawn Actor From Class? Or reference an asset from data table in some other way?

Product Version: UE 4.8
more ▼

asked Jul 30 '15 at 09:49 PM in Blueprint Scripting

avatar image

2k 158 154 210

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

1 answer: sort voted first

in one of links there's FindObject method for C++, it returns UObject that is parent class for all game objects, so try just cast object of this reference into class with same name

for example, you have blueprint called "BP_MyActor", after saving and retrieving UObject reference from FindObject try cast variable with this reference to "BP_MyActor" and save result in variable of such class of course, then you can expose this variable to blueprints or return it to blueprints as reference to store in variable made right in blueprint

more ▼

answered Jul 31 '15 at 12:43 AM

avatar image

576 54 46 72

avatar image Slavq Jul 31 '15 at 11:59 AM

Thanks, but it involves digging into C++, and i mean if it is possible only via Blueprint scripting. For example, i have my .csv data table with quest data. It includes quest name, quest conditions, etc., and quest reward. In "quest reward" column i could put a path to an asset (like in these tutorials), but looks like it works only with C++? :(

If so, maybe i will have to type in item names there, and somehow hardcode them in my blueprint (switch on string -> if "potion" spawn actor potion, if "sword", spawn actor sword, etc...) - Quite tedious, but i can't figure out any other way, if asset paths don't work without digging in C++...

avatar image happyhorror Jul 31 '15 at 02:16 PM


i got idea for you, probably there are 2 implementations of save system:

  1. one on these links that work mostly in automatic way, use objects referencec and so on, but require using C++

  2. the other one is more time wasting, but still possible through blueprints only and below more details how you can achieve it

to make blueprints only saving you probably need to make association array between text class name and object reference, best container will be array of structures, structure should have at least 2 variables inside:

  1. string/name where you can put text class name of any objects or just associate any actor/object class with a custom string

  2. just variable with type "actor" or "object" where you can put any reference to any actors/objects

when you need save:

  1. iterate your game objects for save over such array to get associated text name

  2. save list of such text names in any common way (gues there was few ways, but i don't remember where i saw tutorials, guess you can search how save strings between game launches)

when you need load:

  1. iterate your saved text strings over arrays of these structures to get objects references

  2. spawn these objects by references you got

if you need store any values for objects, like HP, MP, Ammo - just write loops to get values from variables and represent it as strings, like "hp:100500", of course you will need make one more loop to set objects properties from text

avatar image happyhorror Jul 31 '15 at 02:19 PM

to get text reference to instance of object just use "get display name" in this case for example:

you have blueprint called "BP_enemy_pig" with actors and anything else inside, when you "get display name" you'll get string like "BP_enemy_pig№", where № will be unique number of current object instance, so if you make multiple enemy pigs, they most likely will have display names "BP_enemy_pig1", "BP_enemy_pig2", "BP_enemy_pigN+1" where N+1 is just iterator number for base class name, so from this point you can get not only associated text class representation, but also a reference to exact instance of object and your whole strings for saving objects in blueprints may look like this:

common template - "base class name";instance number;values string1,values stringN example "BP_enemy_pig";1;hp:100500,mp:0,lvl:10

note that ; is separator for common properties and , is separator for just values of object, like ho, mp, level and so on

avatar image Slavq Jul 31 '15 at 03:19 PM

Array of structures with ID association is probably the way to go :) Thanks for the hints!

(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