"on destroyed" Events firing when Layout changes

Bugs will be moved here once resolved.

Post » Thu Aug 28, 2014 10:44 am

Problem Description
"on destroyed" Events firing when Layout changes

Attach a Capx
comes later ;)

Description of Capx
____ Concise description of what this CapX does ____

Steps to Reproduce Bug
  • Step 1: have Sprites with an "on destroyed" event like on destroyed->create particles..
  • Step 2: change the layout to a different one, see particles created on the new layout
  • Step 3 etc.

Observed Result
when i change the layout (in my case from Game to Menu) particles are created where on the former layout the sprites with the on destroyed event where

Expected Result
nothing beeing created

Affected Browsers
    every Browser and Previewmode

Operating System and Service Pack
Windows7, Android 4+

Construct 2 Version ID
178
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Post » Thu Aug 28, 2014 2:23 pm

Closing, no .capx attached and the described behavior is by design. Changing a layout destroys all non-global objects, and their 'On destroy' triggers fire accordingly.
Scirra Founder
B
398
S
236
G
88
Posts: 24,433
Reputation: 194,635

Post » Thu Aug 28, 2014 2:30 pm

do you have a solution for that not to happen? destroying non global objects is fine but i dont think anyone want the on destroyed events to happen at this moment, why did you design it that way? is there a reason i dont get? im imaging a lot of problems by this behaviour and more complicated "code"
B
38
S
11
G
5
Posts: 485
Reputation: 5,340

Post » Thu Aug 28, 2014 2:46 pm

Set a flag when changing layouts and ignore the triggers when they fire when that flag is set.

It happens because it is a logical consequence of triggering "on destroyed" when the object is destroyed, and the fact that changing layout destroys all non-global objects.
Scirra Founder
B
398
S
236
G
88
Posts: 24,433
Reputation: 194,635

Post » Thu Aug 28, 2014 2:49 pm

ok thank you, i will try that!
B
38
S
11
G
5
Posts: 485
Reputation: 5,340


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests