In GDevelop every single event is triggered every frame but in many cases it is just a complete waste of resources.
For example, let say I want to trigger different action based on a value of a variable.
If Variable = 1 THEN do something
If Variable = 2 THEN do something else
If Variable = 3 THEN do this
If Variable = 4 THEN do that
In case the value of the variable is equal to 1 and I have no intention to change it right here and now, at the time when all this conditions are checked, the value just can not be 2, 3 and 4 and as a result it pointless to check the value of the variable again and again and again and in case we replace the variable with something using more resources, for example with a collision check with different objects, it may also have significant hit on performance.
In a big, complex game there could be hundreds of events and conditions we are wasting resource and performance on when we don’t even need it.
In most programming languages it can be solved by using an ElseIf statement and I think something similar an “ElseIf event” could be very useful in GDevelop. It doesn’t need to be called “ElseIf” but I just can’t think of anything better right now, but the idea is coming from the ElseIf statement. The way it would work, we could decide to use this special event “ElseIf” anywhere as we see fit as main-event, sub-event and it could also have it own sub-events too. When an ElseIf event is triggered and the condition was true and the actions are executed including the sub-events, GDevelop would jump to the next standard (non ElseIf) event and skip all the ElseIf events in between and all the conditions would be just ignored and not checked.
I believe such event could help with optimization and performance but not only that. At the moment if we want to create a switch we need to apply some variable tricks, by using an ElseIf event we could simply just use 2 events to make a switch.
ElseIf switch = 0 THEN switch = 1
ElseIf switch = 1 THEN switch = 0
This way, in case the switch is 0, we set it to 1 and because the ElseIf event is executed, the next ElseIf would be skipped this time. By using standard event it is just won’t work because as soon as we set the switch to 1, the next event would be triggered and set it back to 0 but the most important use case of ElseIf would be optimization.