forked from judah4/multiscene-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneListGenerator.cs
More file actions
76 lines (67 loc) · 2.38 KB
/
SceneListGenerator.cs
File metadata and controls
76 lines (67 loc) · 2.38 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using EditorTools.Build.Scenes;
using Improbable.Unity;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
public class SceneListGenerator {
[MenuItem("Improbable/Scenes/Validate Scenes")]
public static void ValidateScenes()
{
ValidateClientScenes();
ValidateWorkerScenes();
}
[MenuItem("Twokinds Online/Validate Client Scenes")]
public static void ValidateClientScenes()
{
var buildProc = new PlayerBuildProcess();
buildProc.BeginBuild();
var scenes = buildProc.GetScenes(WorkerPlatform.UnityClient);
for (int cnt = 0; cnt < scenes.Length; cnt++)
{
var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(scenes[cnt]);
//var scene = EditorSceneManager.GetSceneByPath(scenes[cnt]);
if (asset == null)
{
throw new Exception("Scene doesnt exist in Scene Manager: '" + scenes[cnt] + "'");
}
Debug.Log(asset.name);
}
Debug.Log("Client Scenes Exist");
}
[MenuItem("Improbable/Scenes/Validate Worker Scenes")]
public static void ValidateWorkerScenes()
{
var buildProc = new PlayerBuildProcess();
buildProc.BeginBuild();
var scenes = buildProc.GetScenes(WorkerPlatform.UnityWorker);
for (int cnt = 0; cnt < scenes.Length; cnt++)
{
var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(scenes[cnt]);
//var scene = EditorSceneManager.GetSceneByPath(scenes[cnt]);
if (asset == null)
{
throw new Exception("Scene doesnt exist in Scene Manager: '" + scenes[cnt] + "'");
}
Debug.Log(asset.name);
}
Debug.Log("Worker Scenes Exist");
}
private static string[] ReadNames()
{
List<string> temp = new List<string>();
foreach (UnityEditor.EditorBuildSettingsScene scene in UnityEditor.EditorBuildSettings.scenes)
{
if (scene.enabled)
{
string name = scene.path.Substring(scene.path.IndexOf('/') + 1);
name = name.Substring(0, name.Length - 6); //remove .unity
temp.Add(name);
}
}
return temp.ToArray();
}
}