37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using UnityEditor;
|
|
using UnityEditor.SceneManagement;
|
|
using UnityEngine;
|
|
using VS.View;
|
|
|
|
namespace VS.EditorTools
|
|
{
|
|
public static class BuildScene
|
|
{
|
|
const string ScenePath = "Assets/Scenes/Main.unity";
|
|
|
|
// -executeMethod VS.EditorTools.BuildScene.Create
|
|
public static void Create()
|
|
{
|
|
int exit = 0;
|
|
try
|
|
{
|
|
Directory.CreateDirectory("Assets/Scenes");
|
|
var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
|
var go = new GameObject("Game");
|
|
go.AddComponent<GameApp>();
|
|
EditorSceneManager.SaveScene(scene, ScenePath);
|
|
EditorBuildSettings.scenes = new[] { new EditorBuildSettingsScene(ScenePath, true) };
|
|
PlayerSettings.defaultScreenWidth = 720; PlayerSettings.defaultScreenHeight = 1280;
|
|
PlayerSettings.defaultInterfaceOrientation = UIOrientation.Portrait;
|
|
PlayerSettings.productName = "Viral Streamer Clone";
|
|
AssetDatabase.SaveAssets();
|
|
Debug.Log("[VS] scene created at " + ScenePath);
|
|
}
|
|
catch (Exception ex) { Debug.LogError("[VS] BuildScene EXCEPTION: " + ex); exit = 1; }
|
|
EditorApplication.Exit(exit);
|
|
}
|
|
}
|
|
}
|