Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

2D GUI help

Discussion in 'Immediate Mode GUI (IMGUI)' started by BrowDaddy1, May 20, 2015.

  1. BrowDaddy1

    BrowDaddy1

    Joined:
    May 20, 2015
    Posts:
    6
    So I am a complete beginner at everything. I decided for some Extra credit in Spanish to make a 2D Platformer and I want it so when you hit a "Spike" some text apears that says, "Pick A Card!" As well as teleporting the player to the begining. I am using Javascript for the code.
    code :

    #pragma strict


    function OnTriggerEnter(other:Collider) {
    if (other.tag == "Player") {
    function OnGUI () {
    GUI.Label (Rect (10, 10, 100, 20), "Pick A Card!");
    }
    Player.Vector3 = Vector3.new("Begining here")
    }
    }
     
  2. BrowDaddy1

    BrowDaddy1

    Joined:
    May 20, 2015
    Posts:
    6
    What happens is the Pick A Card is always there in the top left of the screen or I get an error with the OnGui function.