Search Unity

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.