Actor not spawning when Event to spawn called

Two things I’m wondering about:

  1. Is that cast working, have you checked?

  2. If the attach fails, what happens? Does it not spawn? Does it end up in the center of the map? etc Have you tried looking for the hair in the world outliner, is it there?

This is my add hair event in a character BP to be called by my character customization widget.

This is my widget BP calling the Event.

The existing hair gets destroyed and then nothing is created with no error. Anyone know what I’m missing?

I don’t think the cast is working. I made it impure and put a print string after it. In play mode there was no string present. What do I do about a cast not working? To answer your other question, nothing happens in the world at all. That would track with the cast not working.

I tried adding the BP as the Pawn but that messes up everything else I’ve done.

I don’t think I want to make the Character model the player in this level, so getting the player character is probably a bad idea (of mine) in the first place.

You see, I’m trying to build a character customization interface. I want the model to spawn on screen and not be controlled. Would it be better if I started over with the model as the pawn anyway? My goal here is to get it to change out different hair sets which are independent Blueprint models. Or is there a better way to cast to an actor in the level?

Yep, that’s what is was. I was simply trying to do the wrong thing. Kind of like 90% of my other issues. Ha!

First, I recommend you use an impure cast and put a print string on the “Cast Failed” branch too, just to make it more clear whether it fails.
There are a few possibilities here and we need to narrow it down to the actual problem.

  1. How can we Get the modular character? Either the cast is failing and your player character isn’t a modular character, or the Get Player Character node is returning a null p1ointer. Since you’re not seeing any errors, I think it’s the former, though I don’t know what your character would be. If it’s a single player game, player 0 should always be the player character, so double check the class. Maybe use a print string on the character, that should give you some insight into its class.

  2. Once we get the character properly, call the function. Put a break point in the function (F9 to put one on a node) so that you’ll see when it gets called, just to make sure it is getting called.

  3. Does the spawn hair function work properly? Maybe the hair is spawning in the wrong place, like out in space or inside the character’s gut. Try making a character without hair, and call the function on beginplay. Then see if you can use the outliner on the right side of the editor to search for the BP Hair Pixie Black actor.

If the cast doesn’t work, it means your player character isn’t a BP_Modular_Character.

Have you set the game mode to put one in the level?

348141-screenshot-6.jpg

Ah, so you just want an empty character standing there?

The you can’t use GetPlayer stuff, because it’s not the player.

You can spawn it. But the use GetActorOfClass to get a reference.