> 정리
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Newtonsoft.Json;
public class App : MonoBehaviour
{
float timer;
int logoWaitingTime;
int titleWaitingTime;
private void Awake()
{
UnityEngine.Object.DontDestroyOnLoad(this);
}
void Start()
{
this.timer = 0.0f; // 타이머
this.logoWaitingTime = 1; // 로고 시간
this.titleWaitingTime = 1; // 타이틀 시간
}
// Update is called once per frame
void Update()
{
this.timer += Time.deltaTime;
if (this.timer > logoWaitingTime){
SceneManager.LoadScene("Logo");
}
if (this.timer > titleWaitingTime){
SceneManager.LoadScene("Title");
this.timer = 0.0f;
}
}
}
> 씬 적용 순서
강의중 기록
App - 로고 - 타이틀 - 로딩화면 - 로비 - 인게임
App: 진입씬
여러가지 씬들은 전환될수 있다
- 씬 (로고, 타이틀)
- 팝업: 닫기 버튼이 무조건 있음
- 페이지: 뒤로가기가 무조건 있음
// 팝업과 페이지는 씬으로 보지 않음
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class App : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
// logo 씬으로 전환
SceneManager.LoadScene("logo");
}
// Update is called once per frame
void Update()
{
}
void log(object data)
{
Debug.Log(data);
}
}
> app -> logo -> title
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class App : MonoBehaviour
{
// Start is called before the first frame update
private void Awake()
{
UnityEngine.Object.DontDestroyOnLoad(this);
}
void Start()
{
// logo 씬으로 전환
SceneManager.LoadScene("logo");
}
// Update is called once per frame
void Update()
{
}
void log(object data)
{
Debug.Log(data);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Title : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
this.log("down click");
SceneManager.LoadScene("Lobby");
}
if (Input.GetMouseButtonUp(0))
{
this.log("up click");
SceneManager.LoadScene("Lobby");
}
}
void log(object data)
{
Debug.Log(data);
}
}
'c# 강의 > 유니티' 카테고리의 다른 글
▶ 마우스 이벤트 (0) | 2020.05.11 |
---|---|
20200511 - 현재까지 패키지 구성 (0) | 2020.05.11 |
20200511 - FindWithTag (자주 쓰이는 예제 필요) (0) | 2020.05.11 |
20200508 - 프리팹 (0) | 2020.05.08 |
20200507 - 캐릭터 생성 및 무기 장착 (0) | 2020.05.08 |