GUI 씬 전환
using UnityEngine;
using System.Collections;
public class test1 : MonoBehaviour {
public int MaxScore;
void Awake(){
//PlayerPrefs.SetInt("HISCORE", 100);
//int highScore = PlayerPrefs.GetInt("HISCORE", 0);
DontDestroyOnLoad(gameObject);
}
// Use this for initialization
void Start () {
MaxScore = 1000;
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
if(GUI.Button(new Rect(10, 10, 300, 100), "score")){
MaxScore += 100;
}
if(GUI.Button(new Rect(10, 150, 190, 100), "next Level")){
if(Application.loadedLevel < Application.levelCount - 1)
Application.LoadLevel(Application.loadedLevel + 1);
//Application.LoadLevelAdditive(Application.loadedLevel + 1);
}
if(GUI.Button(new Rect(200, 150, 190, 100), "prev Level")){
if(1 < Application.loadedLevel){
Application.LoadLevel(Application.loadedLevel - 1);
}
}
if(GUI.Button(new Rect(10, 250, 190, 100), "Retry")){
Application.LoadLevel(Application.loadedLevel);
}
/*
if(GUI.Button(new Rect(200, 250, 190, 100), "Additive")){
Application.LoadLevelAdditive("Test4");
}
*/
if(GUI.Button(new Rect(200, 250, 190, 100), "Additive")){
GameObject npc = GameObject.Find("NPC");
if( npc != null)
Destroy (npc);
Application.LoadLevelAdditive("Common");
}
}
}