Skip to content
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

Show or Hide layer does not show or hide objects from that layer for Conditions #2883

Closed
Silver-Streak opened this issue Aug 7, 2021 · 4 comments
Labels
🐛 bug This is a bug impacting users

Comments

@Silver-Streak
Copy link
Collaborator

Describe the bug

When you use the "Show/Hide Layer" action, while all of the objects are visually hidden from the game, from a logic perspective they're still not treated as hidden.

To Reproduce

Steps to reproduce the behavior:

  1. Create any project
  2. Add a layer.
  3. Add objects to the new layer.
  4. Add an event that hides the layer.
  5. Launch the debugger.
  6. Check the objects. "Is hidden?" stays as no.

Here's the GUI layer hidden:
image

Here's the left text object on the GUI layer (while the layer is hidden), still showing 'Is hidden?" as false.
image

PlatformerBUG.zip

I've tweaked an existing project that was built by someone for the vertical moving platform bug to show this.
A to hide the layer, D to show it.
W to hide the left text object, E to show it.
The platform is tinted green when the left text object is visible, red when it's hidden.
The object is treated as visible unless you manually hide it.

You can work around this by setting up some events that checks for the visibility of an object's layer using expressions, then hiding the object if it is still visible, but this seems like a messy solution if you have a lot of objects.

If this behavior is intentional, it can cause some issues for users that want to hide a large quantity of objects, or use object visibility conditions to do object selection. In this case, I'd recommend adding a parameter to the show/hide layer actions for whether the user wants to also treat the objects as hidden. Default it to "no" to keep current default functionality.

Other details

OS: Windows 10 pro
GD5 version: B114
Extra context: Found this while trying to help Creativesamurai on the discord deal with layer-based menus.

@Bouh Bouh added the 🐛 bug This is a bug impacting users label Aug 7, 2021
@4ian
Copy link
Owner

4ian commented Aug 9, 2021

I would say that currently this "works as intended" as hiding/showing an object is different from hiding/showing a layer.
But I understand this can create some confusion. Should be either reworked or made clearer in the description/sentences?

@Bouh
Copy link
Collaborator

Bouh commented Aug 9, 2021

The logic shouldn't be that visibility has to be inherited from the layer?

It makes more sense, the object isn't visible, it's hidden due to the layer, if the object condition "is visible" return true while the object isn't visible, it's a bit weirdy, don't you think?

@Silver-Streak
Copy link
Collaborator Author

@Bouh I agree with you that the visibility from objects on a layer should be derived from the layer itself. However, If this is currently intended logic, I'd guess any change to its default behavior would be a breaking change if anyone has ever used it expecting it to work as it does today.

@4ian WIth the above in mind, is there no way to add an additional parameter to the show/hide layer actions of "Also show/hide all objects on this layer? Yes/no" With it defaulting to no? That would keep existing behavior as default, but help users avoid a massive quantity of events to hide their objects as well.

If not, then the description verbiage probably needs to be extended to explicitly say something like "Note: This setting changes visibility of the entire layer. Objects on the layer will not be treated as "hidden" for event conditions or actions."

@ClementPasteau
Copy link
Collaborator

Hello 👋
As @4ian mentioned, the concept of hiding/showing a layer is actually really different than hiding/showing an object.
If they were the same, it would create difficult situations where we'd have some logic on specific hidden & visible objects (for instance blinking) in a layer, and by triggering a show/hide of that layer, it could affect that logic.

Instead of changing that behavior, I've added the description you've suggested @Silver-Streak to avoid confusion 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug This is a bug impacting users
Projects
None yet
Development

No branches or pull requests

5 participants