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?

1 Answer

1

You set player to the camera object so is the “RoomCursor” script assigned to the Camera?

Yes. RoomCursor is 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.

...are not* defined...

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."