Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .yamato/project.metafile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ test_editors:
- 2021.1
- 2021.2
- 2020.3
- 2019.4
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether or not to kick 2019.4 out from Yamato CI/CD since we have plans to potentially downgrade back to 2019.4 in the future

- trunk

# Platforms that will be tested. The first entry in this array will also
Expand Down
4 changes: 2 additions & 2 deletions com.unity.multiplayer.mlapi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This is the initial experimental Unity MLAPI Package, v0.1.0.

- Added message batching to handle consecutive RPC requests sent to the same client. `RpcBatcher` sends batches based on requests from the `RpcQueueProcessing`, by batch size threshold or immediately.
- [GitHub 494](https://github.com/Unity-Technologies/com.unity.multiplayer.mlapi/pull/494): Added a constraint to allow one `NetworkObject` per `GameObject`, set through the `DisallowMultipleComponent` attribute.
- Integrated MLAPI with the Unity Profiler for versions 2020.2 and later:
- Integrated MLAPI with the Unity Profiler for versions 2020.3 and later:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should've been 2020.3 LTS instead of 2020.2 already — what you guys think? @lkrell @JesseOlmer


- Added new profiler modules for MLAPI that report important network data.
- Attached the profiler to a remote player to view network data over the wire.
Expand Down Expand Up @@ -85,7 +85,7 @@ With a new release of MLAPI in Unity, some features have been removed:
* Removed "hail handshake", including `NetworkManager` implementation and `NetworkConstants` entries.
* Modified `RpcQueue` and `RpcBatcher` internals to remove encryption and authentication from reading and writing.

* Removed the previous MLAPI Profiler editor window from Unity versions 2020.2 and later.
* Removed the previous MLAPI Profiler editor window from Unity versions 2020.3 and later.
* Removed previous MLAPI Convenience and Performance RPC APIs with the new standard RPC API. See [RFC #1](https://github.com/Unity-Technologies/com.unity.multiplayer.rfcs/blob/master/text/0001-std-rpc-api.md) for details.
* [GitHub 520](https://github.com/Unity-Technologies/com.unity.multiplayer.mlapi/pull/520): Removed the MLAPI Installer.

Expand Down
2 changes: 1 addition & 1 deletion com.unity.multiplayer.mlapi/Documentation~/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Unity MLAPI is a high level networking library built for the Unity game engine t

This version of MLAPI is compatible with the following versions of the Unity Editor:

* 2019.4 and later (recommended)
* 2020.3 and later (recommended) See [Unity Upgrade Guides](https://docs.unity3d.com/Manual/UpgradeGuides.html) if you need to upgrade prior to installation.
* Windows, Mac, Linux platforms are supported by MLAPI

## Document revision history
Expand Down
4 changes: 2 additions & 2 deletions com.unity.multiplayer.mlapi/Editor/CodeGen/CodeGenHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
using Unity.CompilationPipeline.Common.ILPostProcessing;
using UnityEngine;

#if !UNITY_2019_4_OR_NEWER
#error MLAPI requires Unity 2019.4 or newer
#if !UNITY_2020_3_OR_NEWER
#error MLAPI requires Unity 2020.3 or newer
Comment on lines -15 to +16
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would cause a hard compile error on build immediately if somebody were to put MLAPI into a project older than 2020.3 such as 2020.1, 2019.4 etc.

should we keep this or should we rely on package manager, package.json and other things constraining people to get MLAPI on older versions? @mattwalsh-unity @JesseOlmer @seanstolberg-unity

#endif

namespace MLAPI.Editor.CodeGen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
using System.IO;
using Unity.CompilationPipeline.Common.ILPostProcessing;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
using Unity.CompilationPipeline.Common.ILPostProcessing;

namespace MLAPI.Editor.CodeGen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using UnityEngine;
using MethodAttributes = Mono.Cecil.MethodAttributes;
using ParameterAttributes = Mono.Cecil.ParameterAttributes;
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
using ILPPInterface = Unity.CompilationPipeline.Common.ILPostProcessing.ILPostProcessor;
#else
using ILPPInterface = MLAPI.Editor.CodeGen.ILPostProcessor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
using System.Collections.Generic;
using System.IO;
using Mono.Cecil;
Expand Down
2 changes: 1 addition & 1 deletion com.unity.multiplayer.mlapi/Editor/MLAPIProfiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace UnityEditor
{
public class MLAPIProfiler : EditorWindow
{
#if !UNITY_2020_2_OR_NEWER
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, should this just be removed as a whole? Since we were keeping the MLAPIProfiler for version under 2020.2 but 2019.4+. Or for now we keep it like this and remove it whole for 1.0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we aren't fully decided to make 2020.3 LTS baseline version requirement permanent yet. we might consider jumping back to 2019.4 LTS if we get some fixes around ILPP issues we're having — so it's still TBD, that's why I'm still keeping pre-2020.3 blocks around :)

#if !UNITY_2020_3_OR_NEWER
[MenuItem("Window/MLAPI Profiler")]
public static void ShowWindow()
{
Expand Down
4 changes: 2 additions & 2 deletions com.unity.multiplayer.mlapi/Editor/MLAPIProfilerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace MLAPI
[InitializeOnLoad]
internal static class MLAPIProfilerModule
{
#if UNITY_2020_2_OR_NEWER && ENABLE_PROFILER
#if UNITY_2020_3_OR_NEWER && ENABLE_PROFILER
private const string k_RpcModuleName = "MLAPI RPCs";
private const string k_OperationModuleName = "MLAPI Operations";
private const string k_MessageModuleName = "MLAPI Messages";
Expand Down Expand Up @@ -95,7 +95,7 @@ private static bool CreateMLAPIDynamicModule(ref MLAPIModules mlapiModules, stri

static MLAPIProfilerModule()
{
#if UNITY_2020_2_OR_NEWER && ENABLE_PROFILER
#if UNITY_2020_3_OR_NEWER && ENABLE_PROFILER
var dynamicModulesJson = EditorPrefs.GetString("ProfilerWindow.DynamicModules");
var dynamicModules = JsonUtility.FromJson<MLAPIModules>(dynamicModulesJson);

Expand Down
2 changes: 1 addition & 1 deletion com.unity.multiplayer.mlapi/Runtime/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Runtime.CompilerServices;

#if UNITY_2020_2_OR_NEWER && UNITY_EDITOR
#if UNITY_2020_3_OR_NEWER && UNITY_EDITOR
[assembly: InternalsVisibleTo("Unity.Multiplayer.MLAPI.Editor.CodeGen")]
#endif

Expand Down
12 changes: 6 additions & 6 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class NetworkBehaviour : MonoBehaviour
{
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `protected`
internal enum __NExec
#else
Expand All @@ -45,7 +45,7 @@ public enum __NExec
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `protected`
internal __NExec __nexec = __NExec.None;
#else
Expand All @@ -56,7 +56,7 @@ public enum __NExec

[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `protected`
internal NetworkSerializer __beginSendServerRpc(ServerRpcParams serverRpcParams, RpcDelivery rpcDelivery)
#else
Expand Down Expand Up @@ -99,7 +99,7 @@ public NetworkSerializer __beginSendServerRpc(ServerRpcParams serverRpcParams, R

[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `protected`
internal void __endSendServerRpc(NetworkSerializer serializer, ServerRpcParams serverRpcParams, RpcDelivery rpcDelivery)
#else
Expand All @@ -122,7 +122,7 @@ public void __endSendServerRpc(NetworkSerializer serializer, ServerRpcParams ser

[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `protected`
internal NetworkSerializer __beginSendClientRpc(ClientRpcParams clientRpcParams, RpcDelivery rpcDelivery)
#else
Expand Down Expand Up @@ -197,7 +197,7 @@ public NetworkSerializer __beginSendClientRpc(ClientRpcParams clientRpcParams, R

[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `protected`
internal void __endSendClientRpc(NetworkSerializer serializer, ClientRpcParams clientRpcParams, RpcDelivery rpcDelivery)
#else
Expand Down
28 changes: 14 additions & 14 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class NetworkManager : MonoBehaviour, INetworkUpdateSystem
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `public`
internal static readonly Dictionary<uint, Action<NetworkBehaviour, NetworkSerializer, __RpcParams>> __ntable = new Dictionary<uint, Action<NetworkBehaviour, NetworkSerializer, __RpcParams>>();
#else
Expand Down Expand Up @@ -618,7 +618,7 @@ public void Shutdown()
NetworkTickSystem = null;
}

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.Stop();
#endif
IsListening = false;
Expand Down Expand Up @@ -666,7 +666,7 @@ private void OnNetworkEarlyUpdate()
#endif
var isLoopBack = false;

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartTick(TickType.Receive);
#endif

Expand All @@ -687,7 +687,7 @@ private void OnNetworkEarlyUpdate()

m_LastReceiveTickTime = NetworkTime;

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndTick();
#endif

Expand All @@ -707,7 +707,7 @@ private void OnNetworkPreUpdate()
#if DEVELOPMENT_BUILD || UNITY_EDITOR
s_EventTick.Begin();
#endif
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartTick(TickType.Event);
#endif

Expand All @@ -726,7 +726,7 @@ private void OnNetworkPreUpdate()
{
m_LastEventTickTime = NetworkTime;
}
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndTick();
#endif

Expand All @@ -737,12 +737,12 @@ private void OnNetworkPreUpdate()

if (IsServer && NetworkConfig.EnableTimeResync && NetworkTime - m_LastTimeSyncTime >= NetworkConfig.TimeResyncInterval)
{
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartTick(TickType.Event);
#endif
SyncTime();
m_LastTimeSyncTime = NetworkTime;
#if UNITY_EDITOR && !UNITY_2020_2_OR_NEWER
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndTick();
#endif
}
Expand Down Expand Up @@ -830,7 +830,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
#if DEVELOPMENT_BUILD || UNITY_EDITOR
s_TransportConnect.Begin();
#endif
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartEvent(TickType.Receive, (uint)payload.Count, networkChannel, "TRANSPORT_CONNECT");
#endif
if (IsServer)
Expand Down Expand Up @@ -859,7 +859,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
StartCoroutine(ApprovalTimeout(clientId));
}

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
#if DEVELOPMENT_BUILD || UNITY_EDITOR
Expand All @@ -880,7 +880,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N
#if DEVELOPMENT_BUILD || UNITY_EDITOR
s_TransportDisconnect.Begin();
#endif
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartEvent(TickType.Receive, 0, NetworkChannel.Internal, "TRANSPORT_DISCONNECT");
#endif

Expand All @@ -898,7 +898,7 @@ private void HandleRawTransportPoll(NetworkEvent networkEvent, ulong clientId, N

OnClientDisconnectCallback?.Invoke(clientId);

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
#if DEVELOPMENT_BUILD || UNITY_EDITOR
Expand Down Expand Up @@ -949,7 +949,7 @@ internal void HandleIncomingData(ulong clientId, NetworkChannel networkChannel,

uint headerByteSize = (uint)Arithmetic.VarIntSize(messageType);

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartEvent(TickType.Receive, (uint)(data.Count - headerByteSize), networkChannel, messageType);
#endif

Expand Down Expand Up @@ -1081,7 +1081,7 @@ internal void HandleIncomingData(ulong clientId, NetworkChannel networkChannel,

#endregion

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal static void Send(ulong clientId, byte messageType, NetworkChannel netwo
ProfilerStatManager.BytesSent.Record((int)buffer.Length);
PerformanceDataManager.Increment(ProfilerConstants.ByteSent, (int)buffer.Length);

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
Expand All @@ -36,7 +36,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, Netwo

using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
{
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
#endif

Expand All @@ -49,7 +49,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, Netwo
PerformanceDataManager.Increment(ProfilerConstants.ByteSent, (int)buffer.Length);
}

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
Expand All @@ -67,7 +67,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, List<

using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
{
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
#endif

Expand All @@ -80,7 +80,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, List<
PerformanceDataManager.Increment(ProfilerConstants.ByteSent, (int)buffer.Length);
}

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
Expand All @@ -92,7 +92,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, ulong

using (var buffer = MessagePacker.WrapMessage(messageType, messageBuffer))
{
#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.StartEvent(TickType.Send, (uint)buffer.Length, networkChannel, NetworkConstants.MESSAGE_NAMES[messageType]);
#endif

Expand All @@ -109,7 +109,7 @@ internal static void Send(byte messageType, NetworkChannel networkChannel, ulong
PerformanceDataManager.Increment(ProfilerConstants.ByteSent, (int)buffer.Length);
}

#if !UNITY_2020_2_OR_NEWER
#if !UNITY_2020_3_OR_NEWER
NetworkProfiler.EndEvent();
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion com.unity.multiplayer.mlapi/Runtime/Messaging/RpcParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public struct ClientRpcParams
public ClientRpcReceiveParams Receive;
}

#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
// RuntimeAccessModifiersILPP will make this `public`
internal struct __RpcParams
#else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;

#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
using Unity.Profiling.LowLevel;
#endif

namespace MLAPI.Profiling
{
internal struct ProfilerCounterUtility
{
#if UNITY_2020_2_OR_NEWER && ENABLE_PROFILER
#if UNITY_2020_3_OR_NEWER && ENABLE_PROFILER
public static byte GetProfilerMarkerDataType<T>()
{
switch (Type.GetTypeCode(typeof(T)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Unity.Collections.LowLevel.Unsafe;
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
using Unity.Profiling;
using Unity.Profiling.LowLevel;
using Unity.Profiling.LowLevel.Unsafe;
Expand All @@ -17,7 +17,7 @@ namespace MLAPI.Profiling
#endif
internal readonly struct ProfilerCounterValue<T> where T : unmanaged
{
#if UNITY_2020_2_OR_NEWER
#if UNITY_2020_3_OR_NEWER
#if ENABLE_PROFILER
[NativeDisableUnsafePtrRestriction]
[NonSerialized]
Expand Down
Loading