images and colisions

i have one script. but a dont now how to do that:
if i colide with a game object with one tag, he shows a gui button for me
what is wrong?
can you fiz it to me?(i am a noob)
i have other question.
can i put images on my gui button?
whats the script to i do that?
my script:

#pragma strict
var shop : boolean = false;

function Start () {

}

function Update () {

}   
          function OnCollisionEnter(hit: Collision){
         if(hit.gameObject.tag == "shop"){
         shop = !shop;
         if (GUI.Button(Rect(100,150,50,25), "Skills")){}
         }
        
        
        
         }

Check out the new UI. GUI.Button is obsolete.

You need to call legacy GUI functions from OnGUI(), not in the middle of OnCollisionEnter() but @Kiwasi is correct that you should absolutely look into the new UI.

1 Like

can you create one example for me?

The new UI is not primarily scripting like the old way, it’s primarily graphical and it’s far far better in every way. We can’t create an example, for that reason. Check this out for more info:

https://unity3d.com/learn/tutorials/modules/beginner/ui/ui-canvas

ok thanks.