- Home /
How do you access the Blocking Mask of GraphicsRaycaster in code?
I'm trying to change the Blocking Mask of a Graphics Raycaster component of a Canvas via code, but there doesn't appear to be any way to access it. For example, I can access "blockingObjects" like this:
canvas.GetComponent<GraphicRaycaster>().blockingObjects = GraphicRaycaster.BlockingObjects.None;
However, there is no equivalent for the Blocking Mask. Is this just not accessible via code or is there some other way to access it?
Using Unity 5.0.1f
Comment
I am also having this problem. my version is: Unity 5.5.0 b4
Still actual for 5.6. Posted request to Unity Feedback: https://feedback.unity3d.com/suggestions/expose-the-blocking-mask-of-graphicraycaster-to-script Please, support it with your votes!
Answer by IgorAherne · Jul 30, 2019 at 03:30 AM
Perhaps use System.Reflection? In particular try to get FieldInfo