Search Unity

Restart Script???

Discussion in 'Assets and Asset Store' started by ivanzu, Jun 28, 2011.

  1. ivanzu

    ivanzu

    Joined:
    Nov 25, 2010
    Posts:
    2,065
    Hello guys i made a little simple play button for my game but how would i convert it to be a restart script too??
    Code (csharp):
    1.  
    2. var normalTex : Texture2D;
    3. var grayTex : Texture2D;
    4.  
    5. function OnMouseEnter(){
    6.  
    7.     guiTexture.texture = grayTex;
    8.  
    9. }
    10.  
    11. function OnMouseExit(){
    12.  
    13.     guiTexture.texture = normalTex;
    14.    
    15.     Application.LoadLevel("one");
    16.    
    17. }
    18.  
    19. function OnMouseDown(){
    20.  
    21.     Debug.Log("Clicked");
    22.  
    23. }
    24.    
    25.  
     
  2. TheCasual

    TheCasual

    Joined:
    Sep 30, 2010
    Posts:
    1,286
    Couldnt you just simply reload the Level / Scene and if nothing was persistent, it would all be reset?

    Application.LoadLevel("yourScene");