Forum rules - please read before posting.

Change game states events fire a frame late

edited January 2020 in Engine development

It seems that AC waits for next update to figure out whether a game state has changed and fire onChangeState event accordingly. This seems quite easy to adjust on my end, just move the game change state event to the setter of gameState, but before I do I wondered why it's the way it is? Would there be some unforseen consequences if I do that?

As far as I understand AC itself doesn't use it's own public events, so it should be no problem if I have all my external scripts, that make use of this event, under control.

Comments

  • It's to prevent the event firing if the state is changed multiple times in a frame, as well as keep it fired consistently in the core Update loop.

    For what purpose are you hooking into the event such that this becomes an issue?

  • edited January 2020

    I am changing availiable navigation mesh surfaces based on whether we're in cinematic or not. And I'm launching actionlists from inside coroutines. If the first action in actionlist is to move somewhere, the pathfinding ends up not having the new navigation surface mask yet and calculates the path based on gameplay avaliable surface.

    But no worries, it seems AC itself doesn't use the event. So I can just make my own change. I imagine it could be error prone for other projects that use AC to change it globally.

  • OK, though you may get by with hooking into the OnBeginActionList event instead, in that case.

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.