- Home /
Can't disable script
This is really frustrating. I've been trying to do this for the past two days.
So I've added this to my script to hide the custom cursor while text boxes are present:
GameObject Player = GameObject.Find("Main Camera");//with the variables
Player.GetComponent<RoomCursor>().enabled = true;//under OnMouseDown, where the text boxes are toggled
EVERY SINGLE TIME I try to do this, I always get the same error:
"The type or namespace name `RoomCursor' could not be found. Are you missing a using directive or an assembly reference?"
Is there anything I'm doing wrong?
Answer by salex100m · Nov 17, 2013 at 08:32 PM
You set player to the camera object so is the "RoomCursor" script assigned to the Camera?
That error you are getting "Type or Namespace":
That means your classes are defined. Have you defined RoomCursor properly? Is it misspelled? The compilier is saying it can't find that class.
I'm pretty sure I defined it properly, considering I had it open while I was trying to do this so there's no way I could've misspelled it.
When I go to type the script name in GetComponent, it doesn't even notice the script; it just shows all other scripts that contain "Room."
In fact, it can't find any scripts attached to "Player."
Your answer

Follow this Question
Related Questions
How do I call methods from other scripts using C#? 2 Answers
[c#] Add components from de-serialized instance 0 Answers
Is there any reason why I can't use 2 c# scripts on my Player? 3 Answers
How can I hide/expose a gameobject based on its distance from the player/camera? 1 Answer
c# Eval()? 3 Answers