This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
TriggerOnce should apply individually to each instance when used in a ForEach loop #2591
Labels
You can continue the conversation there. Go to discussion →
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.
The text was updated successfully, but these errors were encountered: