Skip to content

Commit 206f789

Browse files
committed
PathManager Init
1 parent 6547a49 commit 206f789

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

Assets/MapEditor/Managers/PathManager.cs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77

88
public static class PathManager
99
{
10+
#region Init
11+
[InitializeOnLoadMethod]
12+
public static void Init()
13+
{
14+
EditorApplication.update += OnProjectLoad;
15+
}
16+
17+
private static void OnProjectLoad()
18+
{
19+
DefaultPath = Resources.Load<GameObject>("Paths/Path");
20+
DefaultNode = Resources.Load<GameObject>("Paths/PathNode");
21+
PathParent = GameObject.FindGameObjectWithTag("Paths").transform;
22+
if (DefaultPath != null && DefaultNode != null && PathParent != null)
23+
EditorApplication.update -= OnProjectLoad;
24+
}
25+
#endregion
26+
1027
public static GameObject DefaultPath { get; private set; }
1128
public static GameObject DefaultNode { get; private set; }
1229
public static Transform PathParent { get; private set; }
@@ -21,20 +38,7 @@ public enum PathType
2138
Powerline = 2,
2239
}
2340

24-
[InitializeOnLoadMethod]
25-
public static void Init()
26-
{
27-
EditorApplication.update += OnProjectLoad;
28-
}
29-
30-
static void OnProjectLoad()
31-
{
32-
DefaultPath = Resources.Load<GameObject>("Paths/Path");
33-
DefaultNode = Resources.Load<GameObject>("Paths/PathNode");
34-
PathParent = GameObject.FindGameObjectWithTag("Paths").transform;
35-
if (DefaultPath != null && DefaultNode != null && PathParent != null)
36-
EditorApplication.update -= OnProjectLoad;
37-
}
41+
3842

3943
public static void SpawnPath(PathData pathData)
4044
{

Assets/MapEditor/Managers/SceneManager.cs

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

88
public static class SceneManager
99
{
10-
public static Scene EditorScene { get; private set; }
11-
1210
#region Init
1311
[InitializeOnLoadMethod]
1412
private static void Init()
@@ -30,6 +28,8 @@ private static void OnProjectLoad()
3028
}
3129
#endregion
3230

31+
public static Scene EditorScene { get; private set; }
32+
3333
#region Scene Camera
3434
/// <summary>Sets/Updates the all SceneViews with inputted culling distances.</summary>
3535
/// <param name="prefabDist">Distance to cull prefabs, in meters.</param>

0 commit comments

Comments
 (0)