OnStartOfLayout trigger while executing official load action
Attach a Capx
https://onedrive.live.com/redir?resid=7 ... ile%2ccapx
Description of Capx
Click, it would do saving, then go to next layout, then do loading
Steps to Reproduce Bug
OnStartOfLayout is triggered while loading. (Print "Start L1")
In the source code, OnStartOfLayou event will be fired while layout start, include official loading.
OnStartOfLayout (Print "Start L1") should not be fired while loading, imo.
Operating System and Service Pack
window7, 32 bit
Construct 2 Version ID
I can reproduce, but it doesn't appear to be a regression so I won't do anything before the next stable release which is due soon.
However I'm not sure it's really a problem in practice: it fires 'On start of layout' to switch to the correct layout just before actually loading the savegame state, so anything the 'On start of layout' event does should be reverted by the subsequent loading. Is this a problem for a real-world project of yours?
You are right, status will be reverted by the subsequent loading, except non-saved status.
For example, to count the playing time of this level:
Designer might increase playing counter which saved in localstorage/post to server while starting this level by "On start of layout".
When player continues the game by loading status, the playing counter will be increased again. It might be a problem, imo.
( Or private variables changing in sprite with no-save behavior... etc. )
Develop games in your browser. Powerful, performant & highly capable.
Changed for the next build.