- Home /
 
Show texture when clicking left mouse button
When I click the left mouse button a texture should appear on the screen with a button to exit this texture. Here is my script and what I have at the moment:
 using UnityEngine;
 using System.Collections;
 
 public class NoteInfo : MonoBehaviour {
     
 //    public Transform target;
     bool drawHint;
     public Texture note1;
     public float lenght = 10;
     
 
     // Use this for initialization
     void Start () {
     
     }
     
     void Update () {
         
     }
     
     
     void OnTriggerStay(Collider other) {
 
         if (other.tag == "Player"){
         
             if (Input.GetMouseButton(0))
         
             {
             
                 drawHint = true;
             
             }
           }
     }
     
     void OnGui () {
         
         if (drawHint)
         {
 //            GUI.Label(new Rect(100, 400, note1.width, note1.height), note1);
             
              GUI.DrawTexture(new Rect(10, 10, 60, 60),note1, ScaleMode.ScaleToFit, true, 10.0F);
              GUI.Button(new Rect(10, 10, 150, 100), "X");
         }
         
     }
 }
 
               can someone help me out?
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
How to change font size in ongui function 0 Answers
GUI.DrawTexture Center on screen 1 Answer
GUI Label "flash a Arrow" 1 Answer
Multiple Cars not working 1 Answer
Texture2D not showing in build, but shows up in editor 1 Answer