using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class akeruthree : MonoBehaviour
{
//public int stage_num; // スコア変数
//public GameObject ni;
public GameObject Popup;
public GameObject score_object = null;
public static int score_num = 0;
// Start is called before the first frame update void Start() { score_num = PlayerPrefs.GetInt("SCORE", 0); Text score_text = score_object.GetComponent<Text>(); score_text.text = "Score:" + score_num; } void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("kaihou3")) { score_num = 200; PlayerPrefs.SetInt("Score", score_num); PlayerPrefs.Save(); } } // Update is called once per frame void Update() { } public void test() { if (score_num < 200) { Popup.SetActive(true); } if (score_num == 200) { SceneManager.LoadScene("wara3"); } }
}
このようなコードを書いてレベル2はセーブさせたけど、レベル3はセーブされませんでした。
レベル3はセーブさせないどころかこのコードを書くとボタンを押しても次のシーンに飛ばなくなります。なぜか分かりますか?
あなたの回答
tips
プレビュー