Forum rules - please read before posting.

AC.KickStarter.player null in OnPlayerSpawn event

edited July 31 in Technical Q&A

Hi

The EventManager has an OnPlayerSpawn event commented with "An event triggered after a Player is spawned in the scene".

However at the point this event is fired, AC.KickStarter.player is still null. It is set (almost) immediately after the event is fired in the PreparePlayer() callback. The player parameter passed to the event listener is the the spawned player, so no issues with that.

While not critical, my event listener ends up calling other methods that assume AC.KickStarter.player is set. Passing the player parameter down to these methods is possible, but messy.

Note:

  • I realize this might be a bit pedantic - mentioning so youre aware. I get changing any order with how the player is spawned in is risky for you :)
  • I do not have playing switching enabled.
  • I didnt reproduce this in a clean project but Id be surprised if I caused it.

Edit: OnSetPlayer is probably what I want - as it looks like that is triggered after the spawn and the set (which I guess makes sense)

Comments

  • Yes, it might be a typo, given the event's name.

    Thanks for raising the issue, I'll look into it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.