i have a datatable for interactable items. when the blueprint is constructed, there is an instance editable variable that i set as what item it should be. (ex. apple)
this works as intended, as when it gets the row name, it sets the image for the in game sprite. the apple LOOKS like an apple.
however, every other variable seems to be of the wrong row.
for ex. when i press E to return the name of the item, it tells me it’s something else (ex. worm instead of apple). i don’t know what the pattern is. it just seems that every item in the world has the data of one specific item (ex. every item will say it’s a worm despite having different icons). i really don’t get it. if the sprite is dependent on the name being correct, then HOW can every other variable be wrong?
the bp isn’t even complicated, so i’m really at a loss.
update from when this was initially sent to be accepted.
it seems that all items get the data from the most recently added interactable object, including the sprite. which is even more odd, since it says the sprite is sprite_worm but it quite literally doesn’t look like that.
“most recently added” as in most recently dragged into the world space.
i believe the name of the item is populated in the instance when i create the item (first image)
Ok some one thing that I notice, it’s that any property not flagged as Instance Editable will be scrapped when Playing In Editor, since it’s not saved per instance.
What you should do instead is Get those variables in BeginPlay, and only use the Construction script for the Sprite as a feedback on what’s placed (and called it again in begin play).
This is hard to say without seeing the more of the system, data table included. But it could be dissonance between your visual feedback and the data contained. Right now, as far as we can tell, the visuals produced by your data table only happen in construction, when you’re at the editor level. If there is anything else in your world that alters that data table and forces it to contain new data you would not see a visual update because you are only changing the look at the time of construction and not during gameplay.
here’s the data table and the structure it inherits from (next post, since im new i can only post one at a time). i just started this project, so there isn’t anything else that changes data values.
Okay, so from what I see, you have a Paper Sprite which will only change while in the editor because its code is in the construction script.
You then have an action bound to the E key prints the current value of Item row name. Pressing a button to have this effect can only happen during gameplay.
This system, as I currently see it, has no way of communicating with the Paper Sprite during gameplay. Could you kindly set something like this up in whatever actor is changing based on the data table?
This will on tick will check your current row data from your previous frame’s row data. If they are different it then updates your variables accordingly. This way you can be sure that during gameplay you are always looking at the correct values and should have the most up-to-date information.
aplogies for the late response. i did this, and it still doesn’t work. i also found out that if i print the variables in begin play, they’re the correct variable values. if i print them from the key event, they’re incorrect. including if i get them directly from a “get data table row” node.
is the issue with when i call the variables? i don’t understand what could be going wrong