複数ステージ①(新シーン作成)








ステージの名前を動的に変更する
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// ★追加
using UnityEngine.SceneManagement;
public class StageName : MonoBehaviour
{
private Text stageNameText;
void Start()
{
stageNameText = this.gameObject.GetComponent<Text>();
// ★追加
// 現在のシーンの名前を取得してtextプロパティにセットする(ポイント)
stageNameText.text = SceneManager.GetActiveScene().name;
}
void Update()
{
stageNameText.color = Color.Lerp(stageNameText.color, new Color(1, 1, 1, 0), 0.5f * Time.deltaTime);
}
}






【2019版】Danmaku Ⅱ(基礎2/全38回)
他のコースを見る







ステージの名前を動的に変更する
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// ★追加
using UnityEngine.SceneManagement;
public class StageName : MonoBehaviour
{
private Text stageNameText;
void Start()
{
stageNameText = this.gameObject.GetComponent<Text>();
// ★追加
// 現在のシーンの名前を取得してtextプロパティにセットする(ポイント)
stageNameText.text = SceneManager.GetActiveScene().name;
}
void Update()
{
stageNameText.color = Color.Lerp(stageNameText.color, new Color(1, 1, 1, 0), 0.5f * Time.deltaTime);
}
}






複数ステージ①(新シーン作成)