Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TriggerOnce should apply individually to each instance when used in a ForEach loop #2591

Closed
tristanbob opened this issue Apr 29, 2021 · 1 comment

Comments

@tristanbob
Copy link
Contributor

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.

@4ian
Copy link
Owner

4ian commented May 11, 2021

I think we would need a "Trigger once per object" maybe to make things very explicit.
This means the condition will check every object, and will filter any object for which it was already passing before.

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").

Repository owner locked and limited conversation to collaborators Feb 15, 2022
@Bouh Bouh converted this issue into discussion #3647 Feb 15, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants