need help with this error

so i’ve used some youtube tutorial videos to make an inventory but i’m getting this error despite doing it exactly according to the video,
can someone take a look and tell me what’s the problem?


Hey @primaldragon100

Access none means your variable (in this case your inventory reference) has not been set. When you trying to use this reference to do something (eg. call a function) it will cause this error. You need to double check how your reference is set.

so for example in this function that the error mentions i didn’t set my inventory reference?


What is your inventory? An Actor you placed in the level (bad) or an Actor Component that’s inside your Controller(good) or Character(okayish)?

it may be an issue with a little diference in the video, in the video it initializes the inventory in the ThirdPlayerCharacter but i made it in the level blueprint like this,
please ignore how it looks like a mess and the stuff after initializing are for making it visible/invisible
and for adding some items from the start of the game.
The visible/invisible stuff works on its own, it became a mess after i made the functions for adding/removing items and trying to see if it would work with adding some items from the start

You want to create a new Actor Component Class and add it to your player character or player controller. This will be your inventory.
The advantage of using a component is, you can re-use it for other things, like chests/containers/shops whatever.

Level blueprint is definitely not the right place for it.

so i initialize my inventory in a new actor, but how do i add this actor in my player character or controller?

Personally I’d use an Actor Component class and add it to the Player State.

Later in your development cycle you’re going to start working on game disconnect scenarios. If your inventory is stored in a level BP, or Character it’ll be instantly wiped without a chance for retrieval on reconnect. Best place is Player state which offers an opportunity on the server side (C++) to do a backup before it wipes its copy of you.

Anyways in the player state class you simply add it in the components tab like you would any other component. Then use the generated reference (variables section) to manage it.

can you use images to show me how i’ll add it in the player state class?

when i try to add ac_inventory to the player’s components it doesn’t appear,
is it something that was added in unreal engine 5 when i use 4 or am i missing something?

Are you manually adding via components tab or are you adding it at run time?

I used them in 4 with no problem.

manually trying to type ac_inventory

Just type “AC Inventory”… No underscore. Underscores bjork the search for some reason.
Or drag and drop it.

Add it to the Actor itself, not to a component that’s already listed.

Demo in UE 4.19

So from what i’m seeing i make an actor component named ac_inventory and drag and drop it but i have to ask a couple questions, first do i leave ac_inventory empty or do i have to do something in its blueprint? And second after i drop it in the player’s blueprint what do i connect it with?

It’s job is to hold and manage your inventory… data and logic.

i mean i get that but that still doesn’t answer the couple of questions above

What’s not answered?
All your variables for inventory are created and stored in the AC_Inventory component blueprint.
All your code to add/deduct inventory is created in this component.
You reference the component as needed. So if your character needs to do something with inventory you drag the node in, pull off the pin and call the function you need to execute.

oh i see but will it initialize that way?

so i made the AC_inventory component but i get a bit of an error


so i try to skip from the create Wg_menu widget to set visibility because i already did that in the component

but i get the error shown above, i tried to use the component but it didn’t connect with the target node of set visibility
Can you help me fix the blueprint and tell me if i did anything wrong in the component’s blueprint?