question

Gui Vaccaro avatar image
0 Likes"
Gui Vaccaro asked Gui Vaccaro commented

Get current object during OnDestroy

Hello,

how can one get the current object being destroyed during OnDestroy? My expectation is that line 2 below would return the object being destroyed, but it returns the model as the owner of this flow.

1740243302791.png

Thank you.

FlexSim 25.0.2
ondestroyownerobject
1740243302791.png (36.6 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Gui Vaccaro avatar image
0 Likes"
Gui Vaccaro answered Gui Vaccaro commented
The question asks for the reference "during", not afterwards.

In fact, I discovered that in the case of OnDestroy, "c" represents the object being destroyed, instead of the "OnDestroy" script as in other commands.


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·
Gui, I think all of the eventfunction calls pass the object in as 'c' unlike many FlexScript nodes where c is the node containing the flexscript.
1 Like 1 ·
Gui Vaccaro avatar image Gui Vaccaro Jason Lightfoot ♦♦ commented ·
Thank you, @Jason Lightfoot , that clarifies it!
0 Likes 0 ·