unity - Play Scene Index or name Call 유니티 플레이 씬 인덱스 혹은 네임


Scene Setting




Check Scene1



Check Scene2








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
 
public class SceneIndexTest : MonoBehaviour {
 
    // Use this for initialization
    void Start () {
        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            Debug.Log("Is Scene name ---------- "+SceneManager.GetActiveScene().name);
            Debug.Log("ex) Func1 Call");
        }
        else if (SceneManager.GetActiveScene().buildIndex == 1)
        {
            Debug.Log("Is Scene name ---------- " + SceneManager.GetActiveScene().name);
            Debug.Log("ex) Func2 Call");
        }
 
    }
 
    // Update is called once per frame
    void Update () {
        
    }
}
 
cs

댓글