LevelSelect
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelSelect : MonoBehaviour {
// Use this for initialization
public bool isSelect=false;
private void Awake(){
}
void Start () {
if(transform.parent.GetChild(0).name==gameObject.name){
}
}
// Update is called once per frame
void Update () {
}
public void Selected(){
PlayerPrefs.SetString("nowLevel","level"+gameObject.name);
SceneManager.LoadScene(*);
}
}
LoadLevel
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadLevel : MonoBehaviour {
// Use this for initialization
private void Awake(){
Instantiate(Resources.Load(PlayerPrefs.GetString("nowLevel")));
}
}