Skip to content

Commit 845e0d5

Browse files
author
Stephen Hodgson
committed
Removed Scene Launcher Checker and added SceneLauncher.prefab back into the scene.
Updated default Editor Build Settings to include the adjustment scene and scene loader scenes by default.
1 parent ae30922 commit 845e0d5

File tree

6 files changed

+77
-88
lines changed

6 files changed

+77
-88
lines changed

Assets/HoloToolkit/Utilities/Prefabs/SceneLauncher.prefab

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ MonoBehaviour:
263263
PersistentKeywords: 1
264264
RecognizerStart: 0
265265
Keywords:
266-
- Keyword: Scene Loader
266+
- Keyword: Scene Launcher
267267
KeyCode: 8
268268
--- !u!114 &114669922776097872
269269
MonoBehaviour:
@@ -277,6 +277,8 @@ MonoBehaviour:
277277
m_Name:
278278
m_EditorClassIdentifier:
279279
sceneMapping:
280+
- ScenePath: Assets/HoloToolkit/Utilities/Scenes/HeadsetAdjustment.unity
281+
IsButtonEnabled: 1
280282
- ScenePath: Assets/HoloToolkit/Utilities/Scenes/SceneLauncher.unity
281283
IsButtonEnabled: 1
282284
ButtonSpawnLocation: {fileID: 1899756416056624}

Assets/HoloToolkit/Utilities/Scenes/SceneLauncher.unity

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ RenderSettings:
4242
--- !u!157 &3
4343
LightmapSettings:
4444
m_ObjectHideFlags: 0
45-
serializedVersion: 9
45+
serializedVersion: 11
4646
m_GIWorkflowMode: 0
4747
m_GISettings:
4848
serializedVersion: 2
@@ -54,7 +54,7 @@ LightmapSettings:
5454
m_EnableBakedLightmaps: 1
5555
m_EnableRealtimeLightmaps: 1
5656
m_LightmapEditorSettings:
57-
serializedVersion: 8
57+
serializedVersion: 9
5858
m_Resolution: 2
5959
m_BakeResolution: 40
6060
m_TextureWidth: 1024
@@ -87,7 +87,7 @@ LightmapSettings:
8787
m_PVRFilteringAtrousNormalSigma: 1
8888
m_PVRFilteringAtrousPositionSigma: 1
8989
m_LightingDataAsset: {fileID: 0}
90-
m_ShadowMaskMode: 2
90+
m_UseShadowmask: 1
9191
--- !u!196 &4
9292
NavMeshSettings:
9393
serializedVersion: 2
@@ -108,48 +108,6 @@ NavMeshSettings:
108108
tileSize: 256
109109
accuratePlacement: 0
110110
m_NavMeshData: {fileID: 0}
111-
--- !u!1 &216353462
112-
GameObject:
113-
m_ObjectHideFlags: 0
114-
m_PrefabParentObject: {fileID: 0}
115-
m_PrefabInternal: {fileID: 0}
116-
serializedVersion: 5
117-
m_Component:
118-
- component: {fileID: 216353463}
119-
- component: {fileID: 216353464}
120-
m_Layer: 0
121-
m_Name: SceneLauncherChecker
122-
m_TagString: Untagged
123-
m_Icon: {fileID: 0}
124-
m_NavMeshLayer: 0
125-
m_StaticEditorFlags: 0
126-
m_IsActive: 1
127-
--- !u!4 &216353463
128-
Transform:
129-
m_ObjectHideFlags: 0
130-
m_PrefabParentObject: {fileID: 0}
131-
m_PrefabInternal: {fileID: 0}
132-
m_GameObject: {fileID: 216353462}
133-
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
134-
m_LocalPosition: {x: 0, y: 0, z: 0}
135-
m_LocalScale: {x: 1, y: 1, z: 1}
136-
m_Children: []
137-
m_Father: {fileID: 0}
138-
m_RootOrder: 3
139-
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
140-
--- !u!114 &216353464
141-
MonoBehaviour:
142-
m_ObjectHideFlags: 0
143-
m_PrefabParentObject: {fileID: 0}
144-
m_PrefabInternal: {fileID: 0}
145-
m_GameObject: {fileID: 216353462}
146-
m_Enabled: 1
147-
m_EditorHideFlags: 0
148-
m_Script: {fileID: 11500000, guid: bd26dc5d91faced46b5d686df88b9a5c, type: 3}
149-
m_Name:
150-
m_EditorClassIdentifier:
151-
sceneLauncherPrefab: {fileID: 1247193059148626, guid: a3f14aa6417acfa4ea1c4feb6af974ab,
152-
type: 2}
153111
--- !u!1001 &348833248
154112
Prefab:
155113
m_ObjectHideFlags: 0
@@ -192,6 +150,48 @@ Prefab:
192150
m_RemovedComponents: []
193151
m_ParentPrefab: {fileID: 100100000, guid: a611e772ef8ddf64d8106a9cbb70f31c, type: 2}
194152
m_IsPrefabParent: 0
153+
--- !u!1001 &1083084514
154+
Prefab:
155+
m_ObjectHideFlags: 0
156+
serializedVersion: 2
157+
m_Modification:
158+
m_TransformParent: {fileID: 0}
159+
m_Modifications:
160+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
161+
propertyPath: m_LocalPosition.x
162+
value: 0
163+
objectReference: {fileID: 0}
164+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
165+
propertyPath: m_LocalPosition.y
166+
value: 0
167+
objectReference: {fileID: 0}
168+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
169+
propertyPath: m_LocalPosition.z
170+
value: 0
171+
objectReference: {fileID: 0}
172+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
173+
propertyPath: m_LocalRotation.x
174+
value: 0
175+
objectReference: {fileID: 0}
176+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
177+
propertyPath: m_LocalRotation.y
178+
value: 0
179+
objectReference: {fileID: 0}
180+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
181+
propertyPath: m_LocalRotation.z
182+
value: 0
183+
objectReference: {fileID: 0}
184+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
185+
propertyPath: m_LocalRotation.w
186+
value: 1
187+
objectReference: {fileID: 0}
188+
- target: {fileID: 4856770467070142, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
189+
propertyPath: m_RootOrder
190+
value: 3
191+
objectReference: {fileID: 0}
192+
m_RemovedComponents: []
193+
m_ParentPrefab: {fileID: 100100000, guid: a3f14aa6417acfa4ea1c4feb6af974ab, type: 2}
194+
m_IsPrefabParent: 0
195195
--- !u!1001 &1541373690
196196
Prefab:
197197
m_ObjectHideFlags: 0

Assets/HoloToolkit/Utilities/Scripts/SceneLauncher.cs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace HoloToolkit.Unity
99
{
10-
public class SceneLauncher : MonoBehaviour
10+
public class SceneLauncher : Singleton<SceneLauncher>
1111
{
1212
[Serializable]
1313
private class SceneMapping
@@ -19,7 +19,7 @@ private class SceneMapping
1919
}
2020

2121
[SerializeField]
22-
[Tooltip("The button scene mapping to keep track of which scenes are enabled in the scene launcher. This list of scenes is generated from the build window active scenes.")]
22+
[Tooltip("The button scene mapping to keep track of which scenes are enabled in the scene launcher. This list of scenes is generated from the build window's active scenes.")]
2323
private SceneMapping[] sceneMapping;
2424

2525
[Tooltip("Location of the center of the grid of buttons in Unity space.")]
@@ -39,6 +39,20 @@ private void OnValidate()
3939
Debug.Assert(SceneButtonPrefab != null, "SceneLauncher.SceneButtonPrefab is not set.");
4040
}
4141

42+
protected override void Awake()
43+
{
44+
// If we have already initialized,
45+
// then we've created a second one.
46+
if (IsInitialized)
47+
{
48+
Destroy(gameObject);
49+
}
50+
else
51+
{
52+
base.Awake();
53+
}
54+
}
55+
4256
private void Start()
4357
{
4458
if (SceneButtonPrefab == null)
@@ -49,7 +63,7 @@ private void Start()
4963
SceneLauncherBuildIndex = SceneManager.GetActiveScene().buildIndex;
5064

5165
// Determine the size of the buttons. Instantiate one of them so that we can check its bounds.
52-
SceneLauncherButton sceneButtonForSize = Instantiate(SceneButtonPrefab);
66+
var sceneButtonForSize = Instantiate(SceneButtonPrefab);
5367
var sceneButtonForSizeCollider = sceneButtonForSize.GetComponent<Collider>();
5468

5569
if (sceneButtonForSizeCollider != null)
@@ -73,10 +87,10 @@ private void CreateSceneButton(GameObject buttonParent, int sceneIndex)
7387
string sceneName = sceneMapping[sceneIndex].ScenePath;
7488
sceneName = sceneName.Substring(sceneName.LastIndexOf("/", StringComparison.Ordinal) + 1);
7589
sceneName = sceneName.Replace(".unity", "");
76-
Scene scene = SceneManager.GetSceneByBuildIndex(sceneIndex);
90+
var scene = SceneManager.GetSceneByBuildIndex(sceneIndex);
7791
Debug.Assert(SceneManager.GetSceneByName(sceneName) == scene);
7892

79-
SceneLauncherButton sceneButton = Instantiate(SceneButtonPrefab, GetButtonPosition(sceneIndex, sceneMapping.Length), Quaternion.identity, buttonParent.transform);
93+
var sceneButton = Instantiate(SceneButtonPrefab, GetButtonPosition(sceneIndex, sceneMapping.Length), Quaternion.identity, buttonParent.transform);
8094
sceneButton.SceneIndex = sceneIndex;
8195
sceneButton.SceneName = sceneName;
8296
sceneButton.MenuReference = ButtonSpawnLocation;
@@ -92,10 +106,10 @@ private Vector3 GetButtonPosition(int sceneIndex, int numberOfScenes)
92106

93107
// Center a grid of cells in a grid.
94108
// The top-left corner is shifted .5 cell widths for every row/column after the first one.
95-
Vector3 topLeft = new Vector3((xCount - 1) * -0.5f, (yCount - 1) * 0.5f, 0.0f);
96-
Vector3 cellFromTopLeft = new Vector3(x, -y, 0.0f);
109+
var topLeft = new Vector3((xCount - 1) * -0.5f, (yCount - 1) * 0.5f, 0.0f);
110+
var cellFromTopLeft = new Vector3(x, -y, 0.0f);
97111
// Scale by size of the button.
98-
Vector3 positionOffset = Vector3.Scale(topLeft + cellFromTopLeft, new Vector3(sceneButtonSize.x, sceneButtonSize.y, 1.0f));
112+
var positionOffset = Vector3.Scale(topLeft + cellFromTopLeft, new Vector3(sceneButtonSize.x, sceneButtonSize.y, 1.0f));
99113

100114
return ButtonSpawnLocation.transform.position + positionOffset;
101115
}

Assets/HoloToolkit/Utilities/Scripts/SceneLauncherChecker.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

Assets/HoloToolkit/Utilities/Scripts/SceneLauncherChecker.cs.meta

Lines changed: 0 additions & 12 deletions
This file was deleted.

ProjectSettings/EditorBuildSettings.asset

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44
EditorBuildSettings:
55
m_ObjectHideFlags: 0
66
serializedVersion: 2
7-
m_Scenes: []
7+
m_Scenes:
8+
- enabled: 1
9+
path: Assets/HoloToolkit/Utilities/Scenes/HeadsetAdjustment.unity
10+
guid: 6328c96cc619a8b41a866766f9513e17
11+
- enabled: 1
12+
path: Assets/HoloToolkit/Utilities/Scenes/SceneLauncher.unity
13+
guid: fd656d2febd0dea46b3825b704706806

0 commit comments

Comments
 (0)