Unity ๋ ์๋จ ๋ฉ๋ด๋ฅผ ์ปค์คํฐ๋ง์ด์ง ํ ์ ์๋ ๊ธฐ๋ฅ์ ๊ฐ๊ณ ์์ต๋๋ค.
Scene ๋ฐ๋ก๊ฐ๊ธฐ ๋ฒํผ, Jenkins ๋น๋ ๋ฒํผ ๋ฑ์ ์์ฃผ ์ฐ๋ ๊ธฐ๋ฅ์ ๋ง๋ค๋ฉด ๋์ฑ ํธ๋ฆฌํ๊ฒ ์ด์ฉํ ์ ์๊ฒ ์ฃ ?
๋ฉ๋ด๋ Script๋ฅผ ํตํด ๋ง๋ค ์ ์์ต๋๋ค. ํ๋์ ๊ฐ์ฒด๋ก ์ฒ๋ฆฌํ๋ ๊ฒ์ด์ง์.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
public class ShortcutScneneMenu{
[MenuItem("Scene Shortcut/Intro")]
private static void MoveIntroScene(){
EditorSceneManager.OpenScene("Assets/Dashboard/Intro/Intro.unity");
}
}
=> Script๋ฅผ ํตํด ShortcutSceneMenu๋ผ๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค๊ณ MenuItem ๋ช ๋ น์ด๋ฅผ ์ด์ฉํด์ Menu UI๋ฅผ ๋ง๋ค๊ณ , ๋ฐ๋ก ์๋์ ์ํ๋ ๊ธฐ๋ฅ(ํจ์)์ ๋ฌ์์ฃผ๋ฉด ๋ฉ๋๋ค. ๋!
=> ๊ทธ ์ธ์๋ ํด๋น ๋ฉ๋ด์ ๋จ์ถํค๋ฅผ ๋ถ์ฌํ ์๋ ์๊ณ , ๋ฉ๋ด ์์ ๋ฉ๋ด๋ฅผ ๋ ๋ง๋ค์ด์ ๊ตฌ์กฐ์ ์ผ๋ก ๊ด๋ฆฌํ ์๋ ์๋ค.
P.S) ์ฒ์์ SceneManager๋ก Scene ๋ก๋๋ฅผ ํ์๋๋ฐ, ์๋์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋๊ธธ๋ ์ค๋ฅ์์ ์๋ดํ๋ EditorSceneManager.OpenScene() ์ ์ฌ์ฉํ์ต๋๋ค.
This can only be used during play mode, please use EditorSceneManager.OpenScene() instead.
๐ EditorSceneManager ๊ด๋ จ ๊ณต์ reference ์ฐธ๊ณ
https://docs.unity3d.com/ScriptReference/SceneManagement.EditorSceneManager.OpenScene.html
Unity - Scripting API: SceneManagement.EditorSceneManager.OpenScene
Use this function to open Scenes in the Hierarchy while in the Editor. This is useful for making custom Editor scripts, tools, or menu items. It is not intended to be used for loading Scenes at run time. To load Scenes at run time, see SceneManager.LoadSce
docs.unity3d.com
'๐ฎ Unity Study > Unity' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Unity] Java ๋๋ Kotlin ์์ค ํ์ผ์ ํ๋ฌ๊ทธ์ธ์ผ๋ก ์ฌ์ฉ (0) | 2022.03.22 |
---|---|
[Unity] Unity SpecialFolders (0) | 2022.03.22 |
[Unity] Plugin (0) | 2021.10.14 |
[Unity] Resource ์ AssetBundles (0) | 2021.10.14 |
[Unity] Timeline, Playable Director, Binding, Clear Bindings (0) | 2021.09.17 |