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
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

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
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Fri Sep 07, 2012 11:01 am

Uh, I found a solution by calling runtime.ClearDeathRow() after destroy other instances.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

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
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

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
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

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
52
S
7
G
6
Posts: 1,945
Reputation: 7,610


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests