# Spawn actor works in my character BP but not in my map BP

**URL:** <https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498>\
**Category:** AI\
**Tags:** unreal-engine, UE4-26, Blueprint, question\
**Created:** [May 22, 2022, 3:06pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498 "2022-05-22T15:06:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lowenfas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lowenfas](https://forums.unrealengine.com/u/Lowenfas)\
**Post date:** [May 22, 2022, 3:06pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/1 "2022-05-22T15:06:11Z")

</div>

I have a blueprint I call Spawners which is supposed to spawn enemies, the Spawners BP is tested and works. My map is randomly generated each game and I am trying to place the Spawners in my map using SpawnActor in my map BP but it won’t work.  
I ran some tests using the event Q pressed in my character blueprint and the spawners worked perfectly. Then I copied and pasted the exact same code in my map BP and it no longer works.  
Why is it that the return value is empty when this code is in my map BP?

 ![Screen Shot 2022-05-22 at 10.57.31 AM](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/4/b34697afe23952ac1d9ec3a6e83ef2cd72b855d3.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [May 22, 2022, 3:24pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/2 "2022-05-22T15:24:49Z")

</div>

Try running it after a short delay.

---

<div class="post-metadata">

**Author:** ![Lowenfas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lowenfas](https://forums.unrealengine.com/u/Lowenfas)\
**Post date:** [May 23, 2022, 3:42pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/3 "2022-05-23T15:42:28Z")

</div>

Adding a delay doesn’t make a difference.

---

<div class="post-metadata">

**Author:** ![Astrotronic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/astrotronic/32/1194566_2.png) [@Astrotronic](https://forums.unrealengine.com/u/Astrotronic)\
**Post date:** [May 23, 2022, 3:51pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/4 "2022-05-23T15:51:26Z")

</div>

Since you said it works in your character, but not when placed in map, I’m thinking that this is an input problem.

When you possess a Character it automatically captures your input, but if you have a BP in your level that you want to trigger with keypresses you’ll need to enable input on it: In BP Class Defaults set ‘Auto Receive Input’ from “Disabled” to “Player 0”

---

<div class="post-metadata">

**Author:** ![Lowenfas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lowenfas](https://forums.unrealengine.com/u/Lowenfas)\
**Post date:** [May 23, 2022, 4:00pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/5 "2022-05-23T16:00:25Z")

</div>

Me adding the Q button press was just a test. In the BPs construction script it runs another function which runs the PlaceSpawners function. Everything else in the construction script/event graph works, its just that dang spawn actors from class that doesn’t do anything.

I could see with some print strings that you were also right about that key press, but no matter how I call it that spawn actor still doesn’t do anything.

---

<div class="post-metadata">

**Author:** ![Astrotronic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/astrotronic/32/1194566_2.png) [@Astrotronic](https://forums.unrealengine.com/u/Astrotronic)\
**Post date:** [May 23, 2022, 4:11pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/6 "2022-05-23T16:11:41Z")

</div>

Hm, as a double-check: After you press play, you can press F8 and take a look at your outliner to see if any spawners have been spawned. (If they’re in-world but just not working maybe)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 23, 2022, 4:47pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/7 "2022-05-23T16:47:03Z")

</div>

> [@Lowenfas](#):
>
> no matter how I call it that spawn actor still doesn’t do anything.

How are you testing this, what are you spawning, what’s in that actor? What are your expectations after spawning vs what happens?

> Then I copied and pasted the exact same code

What code?

---

<div class="post-metadata">

**Author:** ![Lowenfas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lowenfas](https://forums.unrealengine.com/u/Lowenfas)\
**Post date:** [May 23, 2022, 5:24pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/8 "2022-05-23T17:24:18Z")

</div>

I have an actor blueprint in my scene called BP\_MapMaker and in its construction script it runs all the functions to build the map and place the spawners. The Spawners blueprint is supposed to spawn a couple enemy units but I also put a large static mesh component in the blueprint itself just so I can see exactly to visualize where it is.

To test I just compile everything, hit the play button and run around a little bit. If the spawner is in game I should see that large static mesh but it’s never created, I even hit f8 and checked the outliner.

The nodes that I copied and pasted was what was in the picture. Spawn actor from class followed by a print string. It works when I connected it to the Q input in my character blueprint but it stops working in my mapmaker blueprint regardless of the Q input, no matter how it’s called it just doesn’t do anything in my mapmaker BP.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 23, 2022, 5:34pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/9 "2022-05-23T17:34:17Z")

</div>

> [@Lowenfas](#):
>
> I have an actor blueprint in my scene called BP\_MapMaker and in its construction script it runs all the functions to build the map and place the spawners.

Actors placed in the world manually do not fire their Construction Script once the game begins, the Begin Play event is executed, though. Could this be the culprit?

Compiling the BP\_MapMaker, updating it or simply moving it around the scene would fire its Construction Script (a lot!).

---

<div class="post-metadata">

**Author:** ![Lowenfas](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lowenfas](https://forums.unrealengine.com/u/Lowenfas)\
**Post date:** [May 23, 2022, 5:46pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/10 "2022-05-23T17:46:14Z")

</div>

Well turns out the spawner did show up when I called it in a Begin Play event. I guess I’ll just have to keep it hooked up there although I don’t understand what difference that makes.

I could still see before that the Place Spawners event was running because the print strings were still working, for some reason the spawn actor from class just doesn’t do anything unless a begin play event calls it.

---

<div class="post-metadata">

**Author:** ![Astrotronic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/astrotronic/32/1194566_2.png) [@Astrotronic](https://forums.unrealengine.com/u/Astrotronic)\
**Post date:** [May 23, 2022, 6:02pm UTC](https://forums.unrealengine.com/t/spawn-actor-works-in-my-character-bp-but-not-in-my-map-bp/563498/11 "2022-05-23T18:02:54Z")

</div>

Glad to hear you have a solution.

Like ClockworkOcean mentioned, this might be a problem with timing then, other than that, since you’re randomly generating your map some dependencies might not be met at spawn time.

As for understanding what difference it makes, I’ll point you to [this doc](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Actors/ActorLifecycle/) and this non-official [video](https://www.youtube.com/watch?v=IaU2Hue-ApI) trip to the bottom of the rabbit hole. 🐇
