Friday, May 3, 2019

Unity 3d How to show GUI on player collide full script by allunityscripts

 Show GUI On Collide

unity 3d show gui pannel


using UnityEngine;
using System.Collections;

public class ShowGUI : MonoBehaviour {
    private bool showGUI = false;
     public Texture pressE;

    void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.tag == "Player")
        showGUI = true;
    }
    void OnTriggerExit(Collider other)
    {
        if (other.gameObject.tag == "Player")
            showGUI = false;
    }


    void OnGUI()
    {
        if (showGUI == true)
            GUI.DrawTexture(new Rect(Screen.width / 1.5f, Screen.height / 1.4f, 178, 178), pressE);
    }
}

2 comments:

  1. Is it true that you are searching for uPVC Windows and Doors in Islamabad, Pakistan? V-Make offers great uPVC windows and uPVC entryways framework in Rawalpindi, Peshawar, Abbottabad, Kohat, and Mardan.

    ReplyDelete
  2. Thanks . I love to read this content due to the easy readability of this blog.
    visit us:upvc windows in Sialkot

    ReplyDelete