Skip to content

Commit 5ab98dc

Browse files
committed
Styling, renaming and made a field readonly
1 parent aa33ed6 commit 5ab98dc

5 files changed

Lines changed: 21 additions & 24 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ public enum AuthorityModes
13611361
/// <summary>
13621362
/// When set each state update will contain a state identifier
13631363
/// </summary>
1364-
internal static bool TrackStateUpdateId = false;
1364+
internal static bool TrackStateUpdateId;
13651365

13661366
/// <summary>
13671367
/// Enabled by default.
@@ -4692,7 +4692,7 @@ internal static void UpdateNetworkTick(NetworkManager networkManager)
46924692
/// The default value is 1 tick (plus the tick latency). When running on a local network, reducing this to 0 is recommended.<br />
46934693
/// <see cref="NetworkTimeSystem.TickLatency"/>
46944694
/// </remarks>
4695-
public static int InterpolationBufferTickOffset = 0;
4695+
public static int InterpolationBufferTickOffset;
46964696
internal static float GetTickLatency(NetworkManager networkManager)
46974697
{
46984698
if (networkManager.IsListening)

com.unity.netcode.gameobjects/Runtime/Configuration/CommandLineOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ private set
3232

3333
// Contains the current application instance domain's command line arguments
3434
private static List<string> s_CommandLineArguments = new List<string>(Environment.GetCommandLineArgs());
35-
3635
#if UNITY_EDITOR
3736
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
3837
private static void ResetStaticsOnLoad()

com.unity.netcode.gameobjects/Runtime/Core/NetworkUpdateLoop.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ public enum NetworkUpdateStage : byte
7070
/// </summary>
7171
public static class NetworkUpdateLoop
7272
{
73-
private static Dictionary<NetworkUpdateStage, HashSet<INetworkUpdateSystem>> s_UpdateSystem_Sets;
74-
private static Dictionary<NetworkUpdateStage, INetworkUpdateSystem[]> s_UpdateSystem_Arrays;
75-
private const int k_UpdateSystem_InitialArrayCapacity = 1024;
73+
private static Dictionary<NetworkUpdateStage, HashSet<INetworkUpdateSystem>> s_UpdateSystemSets;
74+
private static Dictionary<NetworkUpdateStage, INetworkUpdateSystem[]> s_UpdateSystemArrays;
75+
private const int k_UpdateSystemInitialArrayCapacity = 1024;
7676

7777
static NetworkUpdateLoop()
7878
{
79-
s_UpdateSystem_Sets = new Dictionary<NetworkUpdateStage, HashSet<INetworkUpdateSystem>>();
80-
s_UpdateSystem_Arrays = new Dictionary<NetworkUpdateStage, INetworkUpdateSystem[]>();
79+
s_UpdateSystemSets = new Dictionary<NetworkUpdateStage, HashSet<INetworkUpdateSystem>>();
80+
s_UpdateSystemArrays = new Dictionary<NetworkUpdateStage, INetworkUpdateSystem[]>();
8181

8282
foreach (NetworkUpdateStage updateStage in Enum.GetValues(typeof(NetworkUpdateStage)))
8383
{
84-
s_UpdateSystem_Sets.Add(updateStage, new HashSet<INetworkUpdateSystem>());
85-
s_UpdateSystem_Arrays.Add(updateStage, new INetworkUpdateSystem[k_UpdateSystem_InitialArrayCapacity]);
84+
s_UpdateSystemSets.Add(updateStage, new HashSet<INetworkUpdateSystem>());
85+
s_UpdateSystemArrays.Add(updateStage, new INetworkUpdateSystem[k_UpdateSystemInitialArrayCapacity]);
8686
}
8787
}
8888

@@ -105,19 +105,19 @@ public static void RegisterAllNetworkUpdates(this INetworkUpdateSystem updateSys
105105
/// <param name="updateStage">The <see cref="NetworkUpdateStage"/> being registered for the <see cref="INetworkUpdateSystem"/> implementation</param>
106106
public static void RegisterNetworkUpdate(this INetworkUpdateSystem updateSystem, NetworkUpdateStage updateStage = NetworkUpdateStage.Update)
107107
{
108-
var sysSet = s_UpdateSystem_Sets[updateStage];
108+
var sysSet = s_UpdateSystemSets[updateStage];
109109
if (!sysSet.Contains(updateSystem))
110110
{
111111
sysSet.Add(updateSystem);
112112

113113
int setLen = sysSet.Count;
114-
var sysArr = s_UpdateSystem_Arrays[updateStage];
114+
var sysArr = s_UpdateSystemArrays[updateStage];
115115
int arrLen = sysArr.Length;
116116

117117
if (setLen > arrLen)
118118
{
119119
// double capacity
120-
sysArr = s_UpdateSystem_Arrays[updateStage] = new INetworkUpdateSystem[arrLen *= 2];
120+
sysArr = s_UpdateSystemArrays[updateStage] = new INetworkUpdateSystem[arrLen *= 2];
121121
}
122122

123123
sysSet.CopyTo(sysArr);
@@ -149,13 +149,13 @@ public static void UnregisterAllNetworkUpdates(this INetworkUpdateSystem updateS
149149
/// <param name="updateStage">The <see cref="NetworkUpdateStage"/> to be deregistered from the <see cref="INetworkUpdateSystem"/> implementation</param>
150150
public static void UnregisterNetworkUpdate(this INetworkUpdateSystem updateSystem, NetworkUpdateStage updateStage = NetworkUpdateStage.Update)
151151
{
152-
var sysSet = s_UpdateSystem_Sets[updateStage];
152+
var sysSet = s_UpdateSystemSets[updateStage];
153153
if (sysSet.Contains(updateSystem))
154154
{
155155
sysSet.Remove(updateSystem);
156156

157157
int setLen = sysSet.Count;
158-
var sysArr = s_UpdateSystem_Arrays[updateStage];
158+
var sysArr = s_UpdateSystemArrays[updateStage];
159159
int arrLen = sysArr.Length;
160160

161161
sysSet.CopyTo(sysArr);
@@ -177,7 +177,7 @@ internal static void RunNetworkUpdateStage(NetworkUpdateStage updateStage)
177177
{
178178
UpdateStage = updateStage;
179179

180-
var sysArr = s_UpdateSystem_Arrays[updateStage];
180+
var sysArr = s_UpdateSystemArrays[updateStage];
181181
int arrLen = sysArr.Length;
182182
for (int curIdx = 0; curIdx < arrLen; curIdx++)
183183
{
@@ -292,12 +292,12 @@ public static PlayerLoopSystem CreateLoopSystem()
292292
private static void Initialize()
293293
{
294294
#if UNITY_EDITOR
295-
s_UpdateSystem_Sets = new Dictionary<NetworkUpdateStage, HashSet<INetworkUpdateSystem>>();
296-
s_UpdateSystem_Arrays = new Dictionary<NetworkUpdateStage, INetworkUpdateSystem[]>();
295+
s_UpdateSystemSets = new Dictionary<NetworkUpdateStage, HashSet<INetworkUpdateSystem>>();
296+
s_UpdateSystemArrays = new Dictionary<NetworkUpdateStage, INetworkUpdateSystem[]>();
297297
foreach (NetworkUpdateStage updateStage in Enum.GetValues(typeof(NetworkUpdateStage)))
298298
{
299-
s_UpdateSystem_Sets.Add(updateStage, new HashSet<INetworkUpdateSystem>());
300-
s_UpdateSystem_Arrays.Add(updateStage, new INetworkUpdateSystem[k_UpdateSystem_InitialArrayCapacity]);
299+
s_UpdateSystemSets.Add(updateStage, new HashSet<INetworkUpdateSystem>());
300+
s_UpdateSystemArrays.Add(updateStage, new INetworkUpdateSystem[k_UpdateSystemInitialArrayCapacity]);
301301
}
302302
UpdateStage = default;
303303
#endif

com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ internal bool RemoveServerClientSceneHandle(NetworkSceneHandle serverHandle, Net
548548
/// not destroy temporary scene are moved into the active scene
549549
/// </summary>
550550
internal static bool IsSpawnedObjectsPendingInDontDestroyOnLoad;
551-
552551
#if UNITY_EDITOR
553552
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
554553
private static void ResetStaticsOnLoad()

com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public enum ProtocolType
6868
// frame at 60 FPS. This will be a large over-estimation in any realistic scenario.
6969
private const int k_MaxReliableThroughput = (NetworkParameterConstants.MTU * 64 * 60) / 1000; // bytes per millisecond
7070

71-
private static ConnectionAddressData s_DefaultConnectionAddressData = new ConnectionAddressData { Address = "127.0.0.1", Port = 7777, WebSocketPath = "/", ServerListenAddress = string.Empty };
71+
private static readonly ConnectionAddressData k_DefaultConnectionAddressData = new ConnectionAddressData { Address = "127.0.0.1", Port = 7777, WebSocketPath = "/", ServerListenAddress = string.Empty };
7272

7373
#pragma warning disable IDE1006 // Naming Styles
7474
/// <summary>
@@ -308,7 +308,7 @@ public NetworkEndpoint ListenEndPoint
308308
/// This is where you can change IP Address, Port, or server's listen address.
309309
/// <see cref="ConnectionAddressData"/>
310310
/// </summary>
311-
public ConnectionAddressData ConnectionData = s_DefaultConnectionAddressData;
311+
public ConnectionAddressData ConnectionData = k_DefaultConnectionAddressData;
312312

313313
/// <summary>
314314
/// Parameters for the Network Simulator
@@ -373,7 +373,6 @@ private struct PacketLossCache
373373
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
374374
private static void ResetStaticsOnLoad()
375375
{
376-
s_DefaultConnectionAddressData = new ConnectionAddressData { Address = "127.0.0.1", Port = 7777, WebSocketPath = "/", ServerListenAddress = string.Empty };
377376
s_DriverConstructor = null;
378377
#if UNITY_6000_2_OR_NEWER
379378
OnDriverInitialized = null;

0 commit comments

Comments
 (0)