-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
UnmaskRaycastFilter not working anymore #29
Comments
Hi, I'm new here. I had the same issue today, and I believe the problem was with the If this solution is accurate, here is an edited version of using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions.Editors
{
internal class MenuOptions_UIUnmask
{
[MenuItem("GameObject/UI/Unmask/Tutorial Button")]
private static void CreateTutorialButton2(MenuCommand menuCommand)
{
#if UNITY_2021_2_OR_NEWER
const string menuItemName = "GameObject/UI/Legacy/Button";
#else
const string menuItemName = "GameObject/UI/Button";
#endif
EditorApplication.ExecuteMenuItem(menuItemName);
var button = Selection.activeGameObject.GetComponent<Button>();
button.name = "Tutorial Button";
var unmaskedPanel = CreateUnmaskedPanel(AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd"), Image.Type.Sliced);
var unmask = unmaskedPanel.GetComponentInChildren<Unmask>();
unmask.fitTarget = button.transform as RectTransform;
unmask.fitOnLateUpdate = true;
Selection.activeGameObject = button.gameObject;
}
[MenuItem("GameObject/UI/Unmask/Iris Shot")]
private static void CreateTransition(MenuCommand menuCommand)
{
var unmaskedPanel = CreateUnmaskedPanel(AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/Knob.psd"), Image.Type.Simple);
unmaskedPanel.name = "Iris Shot";
Selection.activeGameObject = unmaskedPanel;
}
[MenuItem("GameObject/UI/Unmask/Unmasked Panel")]
private static GameObject CreateUnmaskedPanel(MenuCommand menuCommand)
{
return CreateUnmaskedPanel(AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd"), Image.Type.Sliced);
}
private static GameObject CreateUnmaskedPanel(Sprite unmaskSprite, Image.Type spriteType)
{
EditorApplication.ExecuteMenuItem("GameObject/UI/Panel");
var mask = Selection.activeGameObject.AddComponent<Mask>();
mask.showMaskGraphic = false;
mask.name = "Unmasked Panel";
mask.GetComponent<Image>().sprite = null;
EditorApplication.ExecuteMenuItem("GameObject/UI/Image");
var unmask = Selection.activeGameObject.AddComponent<Unmask>();
unmask.name = "Unmask";
unmask.transform.SetParent(mask.transform);
unmask.GetComponent<Image>().sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd");
mask.gameObject.AddComponent<UnmaskRaycastFilter>().targetUnmask = unmask;
var image = unmask.GetComponent<Image>();
image.sprite = unmaskSprite;
image.type = spriteType;
EditorApplication.ExecuteMenuItem("GameObject/UI/Panel");
var screen = Selection.activeGameObject.GetComponent<Image>();
screen.name = "Screen";
screen.sprite = null;
screen.color = new Color(0, 0, 0, 0.8f);
screen.transform.SetParent(mask.transform);
return mask.gameObject;
}
}
} Hoping it's not too late to help :) |
## [1.4.2](1.4.1...1.4.2) (2023-10-25) ### Bug Fixes * UnmaskRaycastFilter not working anymore ([14ab505](14ab505)), closes [#29](#29)
🎉 This issue has been resolved in version 1.4.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
It seems that the
UnmaskRaycastFilter
is no longer working. The Button receives no events even though theIsRaycastLocationValid
function behaves correctly.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The button should receive the events
Screenshots
It is not possible to provide a screenshot of it not working
Environment (please complete the following information):
Not sure what I'm doing wrong. I already checked the
IsRaycastLocationValid
and this is working correctly. I also tried different camera settings. The "area" is detected correctly, but the ray is not passing through. Any help is welcome.The text was updated successfully, but these errors were encountered: