"SpawnActor" return value is "None"

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.

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.

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

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).

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

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

Right ok… Thank you for explaining it… very helpful :slight_smile: