forked from Unity-Technologies/com.unity.netcode.gameobjects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneReference.cs
More file actions
69 lines (58 loc) · 1.39 KB
/
SceneReference.cs
File metadata and controls
69 lines (58 loc) · 1.39 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
using System;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[CreateAssetMenu(fileName = nameof(SceneReference), menuName = "Netcode/" + nameof(SceneReference))]
[Serializable]
public class SceneReference : ScriptableObject, ISceneReference
{
#if UNITY_EDITOR
public SceneAsset SceneToReference;
[SerializeField]
private List<SceneAsset> m_IncludedScenes;
#endif
[SerializeField]
private string m_DisplayName;
[HideInInspector]
[SerializeField]
private List<string> m_ReferencedScenes;
#if UNITY_EDITOR
private void OnValidate()
{
if (m_ReferencedScenes == null)
{
m_ReferencedScenes = new List<string>();
}
else
{
m_ReferencedScenes.Clear();
}
if (SceneToReference != null)
{
m_ReferencedScenes.Add(SceneToReference.name);
}
foreach (var includedScene in m_IncludedScenes)
{
if (includedScene != null)
{
m_ReferencedScenes.Add(includedScene.name);
}
}
}
#endif
public string GetDisplayName()
{
return m_DisplayName;
}
public List<string> GetReferencedScenes()
{
return m_ReferencedScenes;
}
}
public interface ISceneReference
{
string GetDisplayName();
List<string> GetReferencedScenes();
}