Destroy other instance at "onDestroy" function

For developers using the Construct 2 Javascript SDK

Post » Sat Sep 01, 2012 12:19 am

Hi @Ashely

I try to destroy other instance at "onDestroy" function in pluign but failed.

inst.onDestroy() (line 1539, preview.js) was called at ClearDeathRow function.
It might miss destroyed instances if these instances was destroyed at "inst.onDestroy".


Thanks for help.rexrainbow2012-09-01 00:20:15
B
99
S
22
G
192
Posts: 4,177
Reputation: 111,217

Post » Wed Sep 05, 2012 6:59 am

I try to make a "container" plugin, which could add other instances into "container" object, and it could destroy these instances under this "container" object when destroyed.

I could destroy other instances at "onDestroy" function before, but failed at current version (r101).

Could @Ashely check it again?rexrainbow2012-09-05 10:09:16
B
99
S
22
G
192
Posts: 4,177
Reputation: 111,217

Post » Fri Sep 07, 2012 11:01 am

Uh, I found a solution by calling runtime.ClearDeathRow() after destroy other instances.
B
99
S
22
G
192
Posts: 4,177
Reputation: 111,217

Post » Fri Sep 07, 2012 1:39 pm

That sounds like it would be buggy... I'll try and fix it from the engine.
Scirra Founder
B
363
S
216
G
75
Posts: 23,120
Reputation: 180,539

Post » Fri Sep 07, 2012 4:11 pm

@Ashley

Thank you very much. It work fine at previous version but I forgot the version number.
B
99
S
22
G
192
Posts: 4,177
Reputation: 111,217

Post » Tue Nov 04, 2014 6:31 am

Sorry to revive this thread, but I need to do something similar to destroy objects in hierarchies, is simply calling onDestroy() the recommended way to destroy instances from a reference?

EDIT: found out about runtime.DestroyInstance() reading the sdk, seems to be what i was looking for.
B
55
S
7
G
6
Posts: 1,949
Reputation: 7,693


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests