- Home /
Why can't I reference Graphics Raycaster in my gameObject?
I am trying to get a reference to the Graphic Raycaster on my Canvas so that I can enable/disable it. This is what I am doing:
shopCanvas.GetComponent<GraphicRaycaster> ().enabled = false;
Why isn't this working ?
Here is a pic of my setup:
Is anything being printed out to the console when you try this? Are you getting an error of some sort, or does it simply appear as though nothing is happening?
It says "The name GraphicRaycaster does not exist in the current context"
Thanks for getting back with that error. You know, I should have asked initially for you to post more of your code. It's still impossible (for me) to tell exactly what's going wrong here. Can you post the relevant parts of your script, including the using statements at the top of the file? We can get it cleared up pretty quickly that way.
No, I forgot to import that. Solved the problem, thanks.
Answer by taxvi · Jan 21, 2015 at 06:54 AM
"The name GraphicRaycaster does not exist in the current context"
are you
using UnityEngine.UI;
??
Your answer
Follow this Question
Related Questions
How to get a certain child from a Canvas? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Fix Position of gameobject. 0 Answers
Show Photon username based on Distance 0 Answers