Instance Destroyed condition #3272
Replies: 4 comments
-
I would tend to rather advise to transform whatever you want to do at the object destruction into a behavior, if that's possible? |
Beta Was this translation helpful? Give feedback.
-
You can just test if the number of object is = 0 once. |
Beta Was this translation helpful? Give feedback.
-
I convert this no-issue/feature request into a discussion. |
Beta Was this translation helpful? Give feedback.
-
Thanks bouh for converting it to a discussion. On Destroy will help in running the sequence of actions that need to be run when a object is deleted (a transition, creating a particle, etc...). On destroy can be helpful the most where an instance can interact with many object (that is, could be destroyed in many ways). While the user has to make events to handle all those interactions, if a complex sequence of animation/effects has to be played for each case (for each object that can interact/destroy with the object), it can get repetitive and become a mess. Many times, ‘trigger once’ will be used when destroying instances, many actions and sequences of actions won’t work well with it, and the Dev is left with no option other than setting up a behaviour.
While a behaviour can solve the problem. If feels like too extensive just to achieve a small task and 2) it will a complex task if a object has to be created when a instance is deleted like a particle (as the object has to be given as a parameter ad linked with the object, don’t know if objects can be given as a property in the new version). Currently behaviours have a lot of bottle necks. Beginner especially don’t want to get into a extensive job just to achieve a small task (beginners to gamedev even).
I think you misunderstood, while ‘number of instances = 0’ can help if any instances of that object exists, it will be hard to set up a system to check if an instance was deleted with it and many things could break and might not be reliable . :) |
Beta Was this translation helpful? Give feedback.
-
Description
A On Destroy which triggers when an instance is deleted can be very helpful. Ex: to play a die animation when the player dies. Many extension have access to delete an object and can be annoying to make events to make it work with those unplanned situations. A OnDestroy can simiplify a lot. It can be implemented once and it will work everytime
Beta Was this translation helpful? Give feedback.
All reactions