# "SpawnActor" return value is "None"

**URL:** <https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464>\
**Category:** Blueprint\
**Tags:** Replication, spawnactor, unreal-engine, question, Blueprint\
**Created:** [April 24, 2018, 4:14pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464 "2018-04-24T16:14:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrBigzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrBigzer](https://forums.unrealengine.com/u/MrBigzer)\
**Post date:** [April 24, 2018, 4:14pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/1 "2018-04-24T16:14:53Z")

</div>

Hi I’m trying to reference a spawned actor that has spawned using “Spawn Actor from Class” but the return value shows up with “None” even though the actor is spawning in the game… anyone knows why?

I think it has something to do with replication and the authority switch I have in front of the SpawnActor… I need it otherwise 2 actors will spawn instead of 1 for the clients connected to the multiplayer game.

 ![238668-spawnactor.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/5/7e5b44746ed238e9918b77a18e42c2de4ad3fbef.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [April 24, 2018, 4:25pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/2 "2018-04-24T16:25:17Z")

</div>

It looks like you are using the Return Value of the spawn in a different execution path. That isn’t a good idea, even when it does work. Try promoting the Return Value to a variable and using that wherever those Return Value wires lead. If you need the actor reference to be usable on the client then turn on replication for this variable.

If that’s not the problem then please show more.

---

<div class="post-metadata">

**Author:** ![ThompsonN13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThompsonN13](https://forums.unrealengine.com/u/ThompsonN13)\
**Post date:** [April 24, 2018, 4:33pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/3 "2018-04-24T16:33:39Z")

</div>

what are you doing when you are trying to reference the actor? like what does the rest of the script look like?

---

<div class="post-metadata">

**Author:** ![MrBigzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrBigzer](https://forums.unrealengine.com/u/MrBigzer)\
**Post date:** [April 24, 2018, 5:06pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/4 "2018-04-24T17:06:32Z")

</div>

Thank you!!! that worked… why isn’t it a good idea to use the return value for a different execution path?

---

<div class="post-metadata">

**Author:** ![MrBigzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrBigzer](https://forums.unrealengine.com/u/MrBigzer)\
**Post date:** [April 24, 2018, 5:07pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/5 "2018-04-24T17:07:32Z")

</div>

thank you for your reply… it’s fixed check the answer below 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [April 24, 2018, 5:16pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/6 "2018-04-24T17:16:32Z")

</div>

The execution path is a series of steps. The Return Value of the node being valid requires that the node is executed (usually). Getting the return value from another execution path is like in C++ if you read the local variable of a different function. Yeah, it may work in some cases because the variable was set previously. But it may stop working if you change things. It’s really ugly and dangerous. It can get confusing to someone looking at it, even you later on in time. Better to be explicit.

Then there’s the client/server thing. If the server spawns the actor then the return value is given to the server. Execution paths running on the client will not see that value because the Spawn node was not run for them. So the server needs to give the return value to the clients using a replicated variable (or RPC I suppose).

---

<div class="post-metadata">

**Author:** ![MrBigzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrBigzer](https://forums.unrealengine.com/u/MrBigzer)\
**Post date:** [April 25, 2018, 1:58pm UTC](https://forums.unrealengine.com/t/spawnactor-return-value-is-none/423464/7 "2018-04-25T13:58:41Z")

</div>

Right ok… Thank you for explaining it… very helpful 🙂
