Why can I not drag and drop a gameobject into my script after declaring the variable in the script.

Alright, I’ve tried for about 5 hours now to find the solution to this issue, I know I will kick myself in the head when it is solved. It’s likely some noob thing I’ve done.

So here is what I want to do, I want to change a GUI Button to be invisible, I have created the button. The button is in the UIcanvas and looks and works great. I want to create a script with a GameObject var and drag and drop the button I to said script. I have watched this be possible in the 2D Catch Game tutorial. However, when I create this script and go to drop the object into the space on the script for GameObject I get the “no way that’s what you want to do symbol”.

I just want to be able to utilize the new UI system and not code all of it. Though it feels like I would be better off coding it all. Please help, my head hurts. Lol. Thank you for your time.

Oh yea, I am trying to do this using UnityScript. I have included the UnityEngine.UI library. Even with a newly opened script in monodev with nothing other than adding the following line outside of the functions:

var myButton:GameObject;

Thanks for your help.

I figured out what I was doing wrong. It was a noob thing after all.

I was trying to drag the object into the script itself in the inspector instead of the object it was attached to.