com.unity.netcode.gameobjects@1.7.1

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [1.7.1] - 2023-11-15

### Added

### Fixed

- Fixed a bug where having a class with Rpcs that inherits from a class without Rpcs that inherits from NetworkVariable would cause a compile error. (#2751)
- Fixed issue where `NetworkBehaviour.Synchronize` was not truncating the write buffer if nothing was serialized during `NetworkBehaviour.OnSynchronize` causing an additional 6 bytes to be written per `NetworkBehaviour` component instance. (#2749)

### Changed
This commit is contained in:
Unity Technologies
2023-11-15 00:00:00 +00:00
parent ffef45b50f
commit 514166e159
10 changed files with 119 additions and 8 deletions

View File

@@ -412,6 +412,19 @@ namespace Unity.Netcode
internal NetworkConnectionManager ConnectionManager = new NetworkConnectionManager();
internal NetworkMessageManager MessageManager = null;
internal struct Override<T>
{
private T m_Value;
public bool Overidden { get; private set; }
internal T Value
{
get { return Overidden ? m_Value : default(T); }
set { Overidden = true; m_Value = value; }
}
};
internal Override<ushort> PortOverride;
#if UNITY_EDITOR
internal static INetworkManagerHelper NetworkManagerHelper;
@@ -658,6 +671,8 @@ namespace Unity.Netcode
return;
}
ParseCommandLineOptions();
if (NetworkConfig.NetworkTransport == null)
{
if (NetworkLog.CurrentLogLevel <= LogLevel.Error)
@@ -1100,5 +1115,39 @@ namespace Unity.Netcode
Singleton = null;
}
}
// Command line options
private const string k_OverridePortArg = "-port";
private string GetArg(string[] commandLineArgs, string arg)
{
var argIndex = Array.IndexOf(commandLineArgs, arg);
if (argIndex >= 0 && argIndex < commandLineArgs.Length - 1)
{
return commandLineArgs[argIndex + 1];
}
return null;
}
private void ParseArg<T>(string arg, ref Override<T> value)
{
if (GetArg(Environment.GetCommandLineArgs(), arg) is string argValue)
{
value.Value = (T)Convert.ChangeType(argValue, typeof(T));
}
}
private void ParseCommandLineOptions()
{
#if UNITY_SERVER && UNITY_DEDICATED_SERVER_ARGUMENTS_PRESENT
if ( UnityEngine.DedicatedServer.Arguments.Port != null)
{
PortOverride.Value = (ushort)UnityEngine.DedicatedServer.Arguments.Port;
}
#else
ParseArg(k_OverridePortArg, ref PortOverride);
#endif
}
}
}