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

How to create highlight area? #220

Closed
Tetromiko opened this issue Dec 19, 2024 · 10 comments
Closed

How to create highlight area? #220

Tetromiko opened this issue Dec 19, 2024 · 10 comments
Assignees
Labels
question Further information is requested released

Comments

@Tetromiko
Copy link

I want to create an FTUE for a project I'm working on, and a highlight area is part of it. The area consists of two parts: a full-screen shadow that covers all UI elements and a light spot that can move to any position. How can I implement the logic so that the shadow blocks all interactions with the UI, while the light spot allows interactions with the interface?

@Tetromiko Tetromiko added the question Further information is requested label Dec 19, 2024
@mob-sakai
Copy link
Owner

Tell me about your develop/build environment.

  • version [e.g. 3.0.0]
  • Platform: [e.g. Editor(Windows/Mac), Standalone(Windows/Mac), iOS, Android, WebGL]
  • Unity version: [e.g. 2022.2.0f1]
  • Build options: [e.g. IL2CPP, .Net 4.x, URP/HDRP]

Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue?
Of course, you don't need to include any secret assets from your project. Feel free to use free assets instead.

repos

@Tetromiko
Copy link
Author

There is nothing to share. I'm creating this logic in a separate clean project on version 2021.3.33f for Android. It is not an issue; I'm just asking if it is possible to achieve my goal, and if the answer is yes, how can I make it?

@mob-sakai
Copy link
Owner

mob-sakai commented Dec 21, 2024

Okay.
That is a common question I ask, and sharing prerequisites is important for providing accurate responses.
For instance, depending on your environment or implementation method, a different approach might be more appropriate.

  • Are the button and the black screen on the same canvas?
  • Is the canvas RenderMode set to ScreenSpaceOverlay or ScreenSpaceCamera?
  • What is the clip shape: rectangular, circular, or star-shaped?
  • Does the clip shape require softness?

This time, I respond assuming a general case:

  • Use a tutorial-specific canvas (ScreenSpaceOverlay).
  • The clip shape is rectangular (non-softness).

See "Sample: Tutorial Button" in the demo scene.
The button underneath the black screen is not interactable, but the part clipped by MaskingShape component (subtractive method) is interactable.


TutorialSample.unity.zip

This scene is a simplified version of the tutorial, containing 2 buttons and a black screen.

The clipping area is defined by "MaskingShape - Subtract" and follows the button using the RectTransformFitter component.

Additional Notes:

  • Ensure that the Sort Order or Order in Layer of the TutorialCanvas is set so it appears in front of the MainCanvas.
  • Set the RenderMode of both MainCanvas and TutorialCanvas to be the same.

@Tetromiko
Copy link
Author

Are the button and the black screen on the same canvas? - Yes
Is the canvas RenderMode set to ScreenSpaceOverlay or ScreenSpaceCamera? - ScreenSpaceOverlay
What is the clip shape: rectangular, circular, or star-shaped? - It is a image with blured circle
Does the clip shape require softness? - Yes

image
image

@mob-sakai
Copy link
Owner

mob-sakai commented Dec 21, 2024

Well, could you tell me what the remaining issue is?
Is it that the button and clip are misaligned?
Or is it that the button is not clickable?

Can you submit a minimal project, scene, or prefab?
Images, assets, or scripts that cannot be submitted are not necessary.

@Tetromiko
Copy link
Author

The screen is completely covered with a shadow, but there is one area where the shadow is “removed” using the Subtract mask. In the shaded area, clicks should be blocked, and in the lightened area, they should be allowed. It's important that this highlighted area can move freely on the screen. Is this functionality supported by the library? If so, how can I implement it correctly?

@Tetromiko
Copy link
Author

We have a Canvas containing some buttons. On the same Canvas, there is a Mask with two children: a shadow mask in "Add" mode and a light spot in "Subtract" mode. When I try to click on the subtracted area, the buttons underneath are not responsive, as if the Mask is intercepting the input.

@mob-sakai
Copy link
Owner

I cannot guess which components are attached to which objects.

For accuracy in the response, please compress the prefab into a zip file and attach it as a comment.
There’s no need to include images or other assets.

Additionally, as a helpful tip, the EventSystem inspector can show which object the raycast hit.
This is also a crucial piece of information.


Now, I noticed that the SoftMask component is blocking raycasts for the MaskingShape (Subtract) component.
This is a bug and will be fixed ASAP. 👍

github-actions bot pushed a commit that referenced this issue Dec 25, 2024
## [3.1.2](3.1.1...3.1.2) (2024-12-25)

### Bug Fixes

* The `SoftMask` component was blocking raycasts to the `MaskingShape (Subtract)` area. ([828c869](828c869)), closes [#220](#220)
@mob-sakai
Copy link
Owner

🎉 This issue has been resolved in version 3.1.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Tetromiko
Copy link
Author

Thank you, you are doing a great job, But when it will be possible to download through git link?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested released
Projects
None yet
Development

No branches or pull requests

2 participants