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. Dismiss Notice

How to open a url?

Discussion in 'Scripting' started by Andrew4Games, Jul 17, 2014.

  1. Andrew4Games

    Andrew4Games

    Joined:
    Jul 17, 2014
    Posts:
    16
    How do i open a url in this main menu for facebook: http://gyazo.com/1cf969a4e7d9fd0c15c0c098684e0dc5
    how to fix it in this Game menu script
    Code (CSharp):
    1. var isQuit=false;
    2.  
    3. function OnMouseEnter(){
    4.     //change text color
    5.     renderer.material.color=Color.red;
    6. }
    7.  
    8. function OnMouseExit(){
    9.     //change text color
    10.     renderer.material.color=Color.white;
    11. }
    12.  
    13. function OnMouseUp(){
    14.     //is this quit
    15.     if (isQuit==true) {
    16.         //quit the game
    17.         Application.Quit();
    18.     }
    19.     else {
    20.         //load level
    21.         Application.LoadLevel(1);
    22.     }
    23.    
    24. }
    25.  
    26. function Update(){
    27.     //quit game if escape key is pressed
    28.     if (Input.GetKey(KeyCode.Escape)) {
    29.             Application.Quit();
    30.     }
    31. }
     
  2. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
  3. Andrew4Games

    Andrew4Games

    Joined:
    Jul 17, 2014
    Posts:
    16
    But how do i fix it for when you click the facebook button and it will only load one page of the facebook?
     
  4. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    Place it somewhere where it will only be called once, such as the OnMouseUp function.