# My blueprint can't access the value of a variable from another actor despite this actor being referenced in a variable

**URL:** <https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526>\
**Category:** Blueprint\
**Tags:** reference, object-reference, accessed-none, unreal-engine, Blueprint, question\
**Created:** [July 16, 2023, 9:14am UTC](https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526 "2023-07-16T09:14:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CubbleC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CubbleC](https://forums.unrealengine.com/u/CubbleC)\
**Post date:** [July 16, 2023, 9:14am UTC](https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526/1 "2023-07-16T09:14:40Z")

</div>

Hello,

I’m making a spawner system that i can place in my world, choose the weapon i want to spawn and when my character walks into it, he can pick it up.

My spawner is a different actor from my weapon and character blueprint, so when i want to know if my weapon (from my spawner) on the ground is pickable, i need to set the pickable? variable in my spawner blueprint, and read it in my character blueprint when i press the key set to trigger an event that will pick up the weapon, set in the weapon blueprint, as seen below.

In my Character blueprint:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/8/70833139d6efc9c68c3d31635b164d415d4476a8.png)

In my weapon blueprint:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/9/70921fb53062c76802a971ab78359b873008419f.png)

In my spawner blueprint:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/4/20465a9e62273c1a52ad9c3a259f101779f42099.png)

My problem is that in-game, after trying to pick up a weapon (which doesn’t work) to leaving the editor, i get an error message saying:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/8/e/d8e0c44e5a25b1def6037a73e288c7758ded4ea6.png)

My character blueprint seems to consider that my pickable? variable is not set, maybe because it is set in another actor, but i don’t get it since i’m taking the variable direrctly from actor it is set at, i tried doing the same but with a cast to instead of creating a reference variable, which removes the error but a print string placed before the call for the pick up event in my Character BP shows that it still can’t read the value. I would be really grateful if someone could at least explain how to properly read variables from another actor inside a blueprint.

Thank you.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [July 16, 2023, 12:35pm UTC](https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526/2 "2023-07-16T12:35:02Z")

</div>

> [@CubbleC](#):
>
> My character blueprint seems to consider that my pickable? variable is not set

The error says the the WeaponSpawner variable in the character is null. From the images shared I don’t see where it is being set. Can you post that part of the blueprint?

* * *

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/8/4e8a6ba613374a3c6887d314527cf1903946dc60.png)  
Also, unrelated to your issue; the PickableWeapon variable should be set after the spawn node, not when the overlap executes.

---

<div class="post-metadata">

**Author:** ![CubbleC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CubbleC](https://forums.unrealengine.com/u/CubbleC)\
**Post date:** [July 16, 2023, 3:49pm UTC](https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526/3 "2023-07-16T15:49:03Z")

</div>

Oh i never thought about setting my weapon spawner variable, that makes so much sense now but that makes it so much more complicated because i don’t know how to set it, since the type of my spawner variable is my spawner. Maybe this isn’t the right way to make a pickable weapon system, but i don’t knoow how to do it better, i really thought this was the best way given the structure of the weapon system.

About the pickable?, the thing is i want to set it to true when my character overlap the spawner hitbox , if setting it to true after the overlap isn’t the right way, how can i do it ?

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [July 16, 2023, 7:56pm UTC](https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526/4 "2023-07-16T19:56:06Z")

</div>

I suggest you check out the 1st person template to see how its setup there, it includes some pickup logic.

* * *

On another note IMO the character should not be aware of the spawner at all. The only thing the character needs is a variable that holds a reference to the picked weapon parent class, if anything.

If you want the spawner to be informed when the wepon it spawned was picked up, then I suggest you place a dispatcher in the weapon that the spawner can listen to. So when the dispatcher fires the spawner can start a timer to spawn a new one, for example.

---

<div class="post-metadata">

**Author:** ![CubbleC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CubbleC](https://forums.unrealengine.com/u/CubbleC)\
**Post date:** [July 17, 2023, 10:20am UTC](https://forums.unrealengine.com/t/my-blueprint-cant-access-the-value-of-a-variable-from-another-actor-despite-this-actor-being-referenced-in-a-variable/1230526/5 "2023-07-17T10:20:33Z")

</div>

Thank you for your suggestions, i looked inside the firstperson template, but it didn’t really help me, but it doesn’t matter because i found another way to do it that doesn’t involve a spawner but directly pick up a weapon that i place inside my level, it’s the system i wanted to make originally but i never really got it working until now, it’s still not working properly but i think i’m close. Thank you a lot for your help and the advices about the structure of my blueprints.
