Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DontDestroyOnloadを使用した例
using UnityEngine;
using System.Collections;
public class LoadScene : MonoBehaviour
{
public int score = 0;
void Awake()
{
score = 30;
DontDestroyOnLoad (gameObject);
}
// click callback
public void OnClick()
{
Application.LoadLevel (1);
}
}
using UnityEngine;
using System.Collections;
public class ReadData : MonoBehaviour
{
void Start ()
{
LoadScene loadScene = FindObjectOfType<LoadScene> ();
Debug.Log (loadScene.score);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.