- Home /
 
               Question by 
               SamuelSiejka · May 30, 2017 at 05:23 PM · 
                scripting problemloadlevelload leveljoin  
              
 
              Need hep changing this script to a onclick script.... please help
here is the script public static class LevelManager { private static string lastLevel;
 public static void setLastLevel(string level)
 {
     lastLevel = level;
 }
 public static string getLastLevel()
 {
     return lastLevel;
 }
 public static void changeToPreviousLvl()
 {
     Application.LoadLevel(lastLevel);
 }
}
i want it to load the previous scene on click... kinda like this code that loads a set scene on click. using UnityEngine; using System.Collections;
public class LoadOnClick : MonoBehaviour {
 public GameObject loadingImage;
 public void LoadScene(int level)
 {
     loadingImage.SetActive(true);
     Application.LoadLevel(level);
 }
}
               Comment
              
 
               
              Answer by ShadyProductions · May 30, 2017 at 05:22 PM
 public static string LastLevel { get; set; }
 
 public static void ChangeToPreviousLvl()
 {
     Application.LoadLevel(LastLevel);
 }
 
 void Update() {
      if (Input.GetMouseButtonDown(0)) { //0 = right click //1 = left click
           ChangeToPreviousLvl();
      }
 }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                