Possess the character from the beginning when simulating?

I have some levels with multiple different AI setups, where one AI is not working. Upon trying to debug, I noticed that no AI works in simulation mode, the BTs and services and such won’t display any flow paths, openng the debug object dropdown in any BT yields “No matching actors found” and several errors are reported.

After having a closer look at these problems, I figured out the following: Each of the pawns needs to reference some stuff from the player character upon spawn, via getPlayerCharacter(0) (the game is singleplayer only so that’s no issue). However, as simulation mode starts out ejected by default, getPlayerCharacter(0) yields None, thus crashing all of my AI-controlled pawns.

Getting simulation mode to auto possess a player character would obviously let me debug my AI, so the important part now is, how do I achieve that?

The only work around I can see is to start in play mode than pres Shift + F1 and click the eject button shown below:

228246-eject.png

This will ensure that everything spawns correctly and you can get the same controls as if you were in simulation mode

It appears that no character gets spawned until you either possess the controller or start in play mode.

That’s not quite the point of it. The reason why I need simulation mode is the flow visualization and watching stuff. AFAIK that’s not possible in normal play mode. However, I couldn’t get simulation mode to start with player possessed. By now I figured out at least some way to start levels with player possessed. Thanks though.

I figured out a workaround for the problem: When you switch levels while playing (no matter if normal play or simulation), the possess/eject option gets carried over. My menu doesn’t yet depend on a player character being present from the start, so loading that, possessing, and making my way to the level in question does the trick. Quite tedious once the cumulative size of the levels grows beyond a certain point, but better than nothing.

For those who don’t have the patience to go through all your levels: You can create an additional (potentially debug-only) level select map, from where you can load all your levels. Make sure it doesn’t depend on your character being possessed right away. Then load that, possess, and load the level you want to debug from there.