Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4da4b22
refactor
NoelStephensUnity Jun 3, 2021
cfe461a
style and refactor
NoelStephensUnity Jun 3, 2021
70e07e8
refactor
NoelStephensUnity Jun 3, 2021
4cfbafd
refactor
NoelStephensUnity Jun 8, 2021
d47281e
refactor
NoelStephensUnity Jun 17, 2021
c2067fd
Merge branch 'develop' into refactor/MTT-819
NoelStephensUnity Jun 17, 2021
6466d6c
refactor and fix
NoelStephensUnity Jun 17, 2021
fdcaaea
Merge branch 'develop' into refactor/MTT-819
NoelStephensUnity Jun 17, 2021
bdfe6b5
Fix
NoelStephensUnity Jun 21, 2021
ab30892
fix
NoelStephensUnity Jun 21, 2021
7b90aaf
Merge branch 'develop' into refactor/MTT-819
NoelStephensUnity Jun 21, 2021
34b33b7
bug test
NoelStephensUnity Jun 21, 2021
83afebc
test
NoelStephensUnity Jun 21, 2021
242ac60
fix
NoelStephensUnity Jun 21, 2021
5ccf813
Merge branch 'refactor/MTT-819' into experimental/networkscenemanager…
NoelStephensUnity Jun 21, 2021
c31e9a0
fix
NoelStephensUnity Jun 22, 2021
44060ed
wip
NoelStephensUnity Jun 22, 2021
b8c6ac1
Merge branch 'refactor/MTT-819' into feat/MTT-820
NoelStephensUnity Jun 22, 2021
9c2d2b4
feat-wip
NoelStephensUnity Jun 22, 2021
a4b7604
SceneRegistration parenting (wip)
NoelStephensUnity Jun 22, 2021
acf4e8d
refactor
NoelStephensUnity Jun 23, 2021
549d82b
refactor and style
NoelStephensUnity Jun 23, 2021
432bfa9
fix
NoelStephensUnity Jun 24, 2021
6fc9283
refactor
NoelStephensUnity Jun 24, 2021
27130ac
refactor
NoelStephensUnity Jun 24, 2021
14eb18d
refactor
NoelStephensUnity Jun 24, 2021
c095ddd
feat
NoelStephensUnity Jun 24, 2021
ee67d97
refactor and fix
NoelStephensUnity Jun 25, 2021
5062baf
refactor
NoelStephensUnity Jun 25, 2021
e389eae
refactor
NoelStephensUnity Jun 26, 2021
b3d230a
fix
NoelStephensUnity Jun 26, 2021
3c666e3
fix
NoelStephensUnity Jun 26, 2021
3345f42
fix
NoelStephensUnity Jun 26, 2021
697791f
refactor
NoelStephensUnity Jun 26, 2021
1a7d881
refactor
NoelStephensUnity Jun 26, 2021
588b3d0
feat and refactor
NoelStephensUnity Jun 27, 2021
a7849a8
fix
NoelStephensUnity Jun 28, 2021
80c5f44
Update com.unity.multiplayer.mlapi/Runtime/Spawning/NetworkSpawnManag…
NoelStephensUnity Jun 28, 2021
0d8f574
fix
NoelStephensUnity Jun 28, 2021
1ded6de
Merge branch 'refactor/MTT-819' into feat/MTT-820
NoelStephensUnity Jun 28, 2021
77a87b5
fix
NoelStephensUnity Jun 28, 2021
82fb5a0
fix
NoelStephensUnity Jun 29, 2021
46a060c
refactor - wip
NoelStephensUnity Jul 1, 2021
cc09a44
refactor-wip
NoelStephensUnity Jul 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions com.unity.multiplayer.mlapi/Editor/NetworkManagerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class NetworkManagerEditor : UnityEditor.Editor
private SerializedProperty m_LoadSceneTimeOutProperty;
private SerializedProperty m_EnableMessageBufferingProperty;
private SerializedProperty m_MessageBufferTimeoutProperty;
private SerializedProperty m_SceneRegistrationProperty;

private ReorderableList m_NetworkPrefabsList;
private ReorderableList m_RegisteredScenesList;
Expand Down Expand Up @@ -157,6 +158,7 @@ private void CheckNullProperties()
m_LoadSceneTimeOutProperty = m_NetworkConfigProperty.FindPropertyRelative("LoadSceneTimeOut");
m_EnableMessageBufferingProperty = m_NetworkConfigProperty.FindPropertyRelative("EnableMessageBuffering");
m_MessageBufferTimeoutProperty = m_NetworkConfigProperty.FindPropertyRelative("MessageBufferTimeout");
m_SceneRegistrationProperty = m_NetworkConfigProperty.FindPropertyRelative("SceneRegistration");
}

private void OnEnable()
Expand Down Expand Up @@ -269,13 +271,17 @@ public override void OnInspectorGUI()
m_NetworkPrefabsList.DoLayoutList();
EditorGUILayout.Space();



using (new EditorGUI.DisabledScope(!m_NetworkManager.NetworkConfig.EnableSceneManagement))
{
m_RegisteredScenesList.DoLayoutList();
EditorGUILayout.Space();
}




EditorGUILayout.LabelField("General", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(m_ProtocolVersionProperty);

Expand Down Expand Up @@ -358,6 +364,7 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(m_RpcHashSizeProperty);

EditorGUILayout.LabelField("Scene Management", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(m_SceneRegistrationProperty);
EditorGUILayout.PropertyField(m_EnableSceneManagementProperty);

using (new EditorGUI.DisabledScope(!m_NetworkManager.NetworkConfig.EnableSceneManagement))
Expand Down
62 changes: 62 additions & 0 deletions com.unity.multiplayer.mlapi/Editor/ReadOnlyPropertyDrawer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEditor;
using UnityEditor.SceneManagement;
using MLAPI.SceneManagement;
using UnityEditor.UIElements;
using UnityEngine.UIElements;

namespace MLAPI.Editor
{
[CustomPropertyDrawer(typeof(ReadOnlyPropertyAttribute))]
public class ReadOnlyPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
// Disable the read only field
GUI.enabled = false;
EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, position.height), property, label);
GUI.enabled = true;
EditorGUI.EndProperty();
}
}

[CustomPropertyDrawer(typeof(SceneReadOnlyPropertyAttribute))]
public class SceneRegistrationReadOnlyPropertyDrawer : PropertyDrawer
{
private const int k_ButtonWidth = 140;

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
// Disable the read only field
GUI.enabled = false;
try
{
EditorGUI.PropertyField(new Rect(position.x + k_ButtonWidth + 3, position.y, position.width - (k_ButtonWidth + 3), position.height), property);
}
catch (System.Exception ex)
{
Debug.LogError(ex);
}

GUI.enabled = true;
EditorGUI.EndProperty();

// Add a button to open the scene containing the network manager referencing the SceneRegistration
if (GUI.Button(new Rect(position.x, position.y, k_ButtonWidth, 20), "Load Referencing NetworkManager Scene"))
{
var value = property.objectReferenceValue as SceneAsset;
if (value != null)
{
EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(value), OpenSceneMode.Single);
}
}
}
}




}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions com.unity.multiplayer.mlapi/Editor/SceneHierarchyMonitor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;

namespace MLAPI.Editor
{
[InitializeOnLoad]
public static class SceneHierarchyMonitor
{
static SceneHierarchyMonitor()
{
EditorApplication.hierarchyChanged += OnHierarchyChanged;
}

public static readonly List<SceneAsset> CurrentScenesInHierarchy = new List<SceneAsset>();

public static void RefreshHierarchy()
{
OnHierarchyChanged();
}



static private void OnHierarchyChanged()
{
var all = Resources.FindObjectsOfTypeAll(typeof(SceneAsset));
if (all.Count() != CurrentScenesInHierarchy.Count())
{
CurrentScenesInHierarchy.Clear();
foreach (var sceneAsset in all)
{
if (!CurrentScenesInHierarchy.Contains(sceneAsset))
{
CurrentScenesInHierarchy.Add(sceneAsset as SceneAsset);
}
}
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading