TriggerOnce should apply individually to each instance when used in a ForEach loop #3647
tristanbob
started this conversation in
Enhancement ideas (and their technical discussions)
Replies: 2 comments
-
I think we would need a "Trigger once per object" maybe to make things very explicit. And ideally a check that warn if a Trigger Once is detected inside an event (this could be part of a more generic "diagnostic report"). |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm linking to this extension which has a similar goal: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Users often try to use TriggerOnce inside a ForEach loop, only to find that TriggerOnce doesn't work the way they expect it to. This is because when TriggerOnce is used inside ForEach, it will be triggered if ANY instance of the object matches the condition. Users are expecting each instance to be treated individually.
Discord chat about this topic
Game that demonstrates problem:
ForEachTriggerOnce.zip
Expected: Whenever you toggle the tint variable of an instance, the color toggles on that instance.
What happens: To tint an object, you need to make the variable false on ALL objects first, because the trigger once applies on all instances despite being in a for each event
Solution suggested
arthuro555:
I don't think we can really modify the behavior of such a core component, that would break most games that have a trigger once inside a for each
Silver-Streak:
🤔 what about modify the trigger once condition to have a toggle? "When used in a For Each event, this will activate for every instance including new: YES/NO"
No as the default (same behavior as today)
Tristan (Victris Games):
Can we manage this change the same way the default Z order was implemented? We add a section in preferences that explains the change and if the user wants to modify an existing project with the new setting. By default, new projects get the new setting, but old projects must click on that button or no change will happen.
Beta Was this translation helpful? Give feedback.
All reactions