Is there any consistency to the data that the scan will report to the player? If so you could make a custom struct that contains text variables such as ‘Name’, ‘Description’, ‘Weight’, or whatever you need. When you scan a scan-able object it would returns its data as that struct, and from there you can get the values and populate your widget or however you are displaying the text. If you had a base ‘scan-able object’ Blueprint class which had this struct as a variable, then any instance of that class could have it’s details modified and contained in that struct. It would work in the same way if you just need one line of text, just have a text variable in your class that contains the information. I think a struct would work better though if you decide to had more categories to the scan results later on, for example.
Some info here: https://docs.unrealengine.com/en-us/Engine/Blueprints/UserGuide/Variables/Structs
You create new structs in the content browser, by right clicking > Blueprints > Structure
Okay, I would like to create a scan log system where the player scans an object and information about that object comes up. What would be the best way to do it? Using a data table, a string table or simply using a blueprint where I just pass the text I would like to show to the main character? I am completely new to Unreal so any help is appreciated. Thank you very much.
A system like this could easily range from simple to complex, it all depends on the scope of what you’re trying to achieve.
Structs + DataTables are the way to go, sure. As you create the object, feed it the appropriate struct (makes it easier to save the modified data later on, too). Highlighting the object pulls the struct and feeds a widget displaying the info.
If you need only one scanned object info on screen at a time, you might as well get away with a single widget owned by the player character.
tl;dr - your logic sounds fine
You can expand it by using Event Dispatchers and/or Interfaces if you need more than one way to interact with various objects. There’s a dozen ways one can set up a system like that.
Okay, my system is a little complicated. I would like a scan system where the characters in the game (it’s an RPG) can actually comment on the scannable object. That means that I would need a system where for each object I must also contain the dialogue of each character and also that as the story progresses the dialogue or scan info may change. A structure seems like a fairly good idea, I think I’m gonna go with it along with a BP_Scannable but my problem is, how do I change the scanInfo/Dialogue as the story progresses?
Ok, say we have a temple in the game and I can scan it at the start of the game and obtain the intial information about what that temple is.The characters each make a comment according their religion/character. After a while I gain more info about the local religion (maybe meet the temple’s priest) and I scan the temple again. This time different info can come up. Something along the lines of that.
If a Data Table is your recommendation can you please mention the system in a little more detail. You mean having a public Data Table variable for each scannable object or having a Data Table for each region and load it dynamically?
Hm, in that case, as Everynone mentioned, you’ll probably want a data table (It is possible to change the values of the struct at run time, but, I think a data table sounds cleaner here). I’m not sure if I’m understanding exactly what you mean though. Could you give a more detailed in-game of example of what you’re talking about?