Skip to content

Commit 14ab505

Browse files
committed
fix: UnmaskRaycastFilter not working anymore
close #29
1 parent a276ef6 commit 14ab505

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Scripts/Editor/MenuOptions.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ private static void CreateTutorialButton2(MenuCommand menuCommand)
2323
unmask.fitTarget = button.transform as RectTransform;
2424
unmask.fitOnLateUpdate = true;
2525

26-
var screen = unmaskedPanel.transform.Find("Screen").GetComponent<Image>();
27-
screen.gameObject.AddComponent<UnmaskRaycastFilter>().targetUnmask = unmask;
28-
2926
Selection.activeGameObject = button.gameObject;
3027
}
3128

@@ -37,6 +34,12 @@ private static void CreateTransition(MenuCommand menuCommand)
3734
Selection.activeGameObject = unmaskedPanel;
3835
}
3936

37+
[MenuItem("GameObject/UI/Unmask/Unmasked Panel")]
38+
private static GameObject CreateUnmaskedPanel(MenuCommand menuCommand)
39+
{
40+
return CreateUnmaskedPanel(AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd"), Image.Type.Sliced);
41+
}
42+
4043
private static GameObject CreateUnmaskedPanel(Sprite unmaskSprite, Image.Type spriteType)
4144
{
4245
EditorApplication.ExecuteMenuItem("GameObject/UI/Panel");
@@ -51,6 +54,8 @@ private static GameObject CreateUnmaskedPanel(Sprite unmaskSprite, Image.Type sp
5154
unmask.transform.SetParent(mask.transform);
5255
unmask.GetComponent<Image>().sprite = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd");
5356

57+
mask.gameObject.AddComponent<UnmaskRaycastFilter>().targetUnmask = unmask;
58+
5459
var image = unmask.GetComponent<Image>();
5560
image.sprite = unmaskSprite;
5661
image.type = spriteType;
@@ -65,4 +70,4 @@ private static GameObject CreateUnmaskedPanel(Sprite unmaskSprite, Image.Type sp
6570
return mask.gameObject;
6671
}
6772
}
68-
}
73+
}

0 commit comments

Comments
 (0)