Documentation for GraphicRaycaster in Unity 2020.x series is not clear ...

Hi,

In past versions of Unity (2017 … 2019) documentation for GraphicRaycaster class was clearly visible within the “Scripting API” section.

However for Unity 2020.x it is not clear. Pls advice.

Code containing GraphicRaycaster.Raycast is working. A new “Canvas” object in the Unity Editor brings up the component “Graphic Raycaster” by default. Yet in the “manual” the “Graphic Raycaster” component is not described although other components of “Canvas” have been.

Regards
/rk

1 Like

Hi rk,

So as of 2020.x, the GraphicRaycaster class has been moved into the Unity UI package. You can find the package here:
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/index.html

and the specific manual page for GraphicRaycaster here:
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-GraphicRaycaster.html?q=raycast

The Scripting API entry for GraphicRaycaster is also in the package docs here:
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.UI.GraphicRaycaster.html

Your code still works because Unity UI is a builtin package and gets installed as part of the normal Unity installation process. We’ll add a note to the 2018 and 2019 versions of the docs to communicate where this has moved to in the later version.

Hopefully this has cleared things up a little for you, thanks for giving us this feedback!

1 Like