How to give variable a value

Hey,
I have been following this tutorial here, I’m trying to make a game mechanic where when the player picks up an item it will be logged into a journal. Kinda like the journal mechanic in Uncharted.

The current problem is the item found won’t stay in the journal if I don’t have the journal open when I pick it up.
2023-12-07 14-04-50.mkv (6.4 MB)


This is the error that will show, so I think the prob is with how I set the “inventory widget variable”

Here is the code

I hope this makes sense!

You invalidate the reference. When you open the journal next time, you instead create a brand new journal widget, which will have nothing in it. The old journal with the entry will be destroyed.

Just hide the journal. This SET node at the bottom has to go!


The old journal with the entry will be destroyed.

This is actually not true; this is, in fact, leaking memory. You keep adding those journal widgets to the viewport which will not let the Garbage Collection system swoop in and release memory.

I’m not sure if this is what you meant but I did take that set node away and made just the journal’s visibility change.

But now I have the item of the item not appearing at all, this i what its looking like now.


This is for picking up the item and adding it to the journal


This is the actor component (inventory), that’s used at the end of the E key

The error message says that the issue is with the inventory.

Only the bottom SET needs to go.

I did do that i must have something else wrong, im thinking of maybe starting the whole thing over again or finding a different tutorial

The script looks fine(ish) apart from the that one SET node. This is a very common thing to do:

Try it like so.


The journal is working fine now !
its just the object im picking won’t add the widget on to the journal

Here’s what i copied

Can we see how it’s being done? Scriptwise?

This is how the item is picked up with E


This is the pickup item function

This is the actor componant to add it to the journal


Then this is the journal itself

I hope this makes sense!

Shouldn’t you be doing this In the first image:

You had it there before and made sense. Or do you trigger this:

image

Some other way now?