Last active
June 17, 2018 06:12
-
-
Save sukedon/eba11f6f4f48dbd82b1cabdbb200d069 to your computer and use it in GitHub Desktop.
RaycastTargetをオフるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine.UI; | |
public static class RaycastTargetDisabler | |
{ | |
[MenuItem("GameObject/Disable RaycastTarget", false, -1)] | |
public static void Disable() | |
{ | |
var selected = Selection.activeGameObject; | |
if (!selected) | |
{ | |
return; | |
} | |
var graphics = selected.GetComponentsInChildren <Graphic>(true); | |
foreach (var graphic in graphics) | |
{ | |
if (!graphic.GetComponent <Button>()) | |
{ | |
graphic.raycastTarget = false; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment