Adding new blueprint service to game

Hi,

I’m trying to add a custom blueprint service to my game, in this case a simple character manager.
I did some testing and added it to the game mode, the problem is that my event begin play in the game mode isn’t getting hit until after all my characters are created, so it fails.

Where is the best place to put a new blueprint service so that it’s setup first when the game runs?

Thanks,
Dave

As you can see from the logs, the character gets setup before the Game Mode or the Map. When I say setup here, I’m referring to event begin play.

LogBlueprintUserMessages: [CHAR_Bob_2] Char manager is none

LogBlueprintUserMessages: [GameMode_C_0] Char manager is setup

LogBlueprintUserMessages: [Devmap_C_3] Hello

Hey daveREspawn,

I am a bit confused on why your Blueprint would fail because it gets called after your Character is created. Doesn’t that mean your Character is valid and therefore can be used?

Let me know what your goal is with your Character Manager and maybe I can help more.

Thanks.

Oh, so the goal of the Character Manager is to have it get created after the Character does?

Hi,

Thanks for replying. So the characters are working fine and without issue.

Here’s what I’m trying to do:

  1. Game starts and the character manager is created
  2. Any time a new character is added to the game world, the character calls the register function on the character manager

This way, when the game is running the character manager is aware of al the characters in the world.

So the issue I’m having right now is tha the characters are being created before the character manager is created.
So if the game mode is being created / started after everything else, where is the best place to put a new service like this character manager?

Cheers,
Dave

I’ve been able to get around the issue by constantly checking if the character manager is none, and forcing a spawn if it is.
While this works, I’d be interested if you know a better way of setting up a game service like this?

Is the goal for the Character Manager just to keep track of the Characters being spawned?

For now yes, the plan is to then expand on that so I can make sure only 20 of a certain character exist in the world, track which characters are parented to other characters, more advanced things like that.

Hey daveREspawn,

This is the method I would take if doing the same thing:

Thanks, that’s very similar to what I have now.
Thanks for taking the time to answer this.