mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
obsolete support instead of modifying original
This commit is contained in:
parent
21115a3785
commit
3815ec6576
@ -22,7 +22,7 @@ public enum SyncDirection { ServerToClient, ClientToServer }
|
||||
// [RequireComponent(typeof(NetworkIdentity))] disabled to allow child NetworkBehaviours
|
||||
[AddComponentMenu("")]
|
||||
[HelpURL("https://mirror-networking.gitbook.io/docs/guides/networkbehaviour")]
|
||||
public abstract class NetworkBehaviour : MonoBehaviour
|
||||
public abstract partial class NetworkBehaviour : MonoBehaviour
|
||||
{
|
||||
/// <summary>Sync direction for OnSerialize. ServerToClient by default. ClientToServer for client authority.</summary>
|
||||
[Tooltip("Server Authority calls OnSerialize on the server and syncs it to clients.\n\nClient Authority calls OnSerialize on the owning client, syncs it to server, which then broadcasts it to all other clients.\n\nUse server authority for cheat safety.")]
|
||||
@ -1070,7 +1070,7 @@ protected T GetSyncVarNetworkBehaviour<T>(NetworkBehaviourSyncVar syncNetBehavio
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// ensure componentIndex is in range.
|
||||
// show explicit errors if something went wrong, instead of IndexOutOfRangeException.
|
||||
// removing components at runtime isn't allowed, yet this happened in a project so we need to check for it.
|
||||
|
@ -38,7 +38,7 @@ public struct NetworkIdentitySerialization
|
||||
[DefaultExecutionOrder(-1)]
|
||||
[AddComponentMenu("Network/Network Identity")]
|
||||
[HelpURL("https://mirror-networking.gitbook.io/docs/components/network-identity")]
|
||||
public sealed class NetworkIdentity : MonoBehaviour
|
||||
public sealed partial class NetworkIdentity : MonoBehaviour
|
||||
{
|
||||
/// <summary>Returns true if running as a client and this object was spawned by a server.</summary>
|
||||
//
|
||||
|
@ -1,4 +1,7 @@
|
||||
using System;
|
||||
|
||||
namespace Mirror
|
||||
{
|
||||
public interface NetworkMessage {}
|
||||
// OLD NETWORK PROFILER SUPPORT: inherit from old IMessageBase. Later don't inherit from anything.
|
||||
public interface NetworkMessage : IMessageBase {}
|
||||
}
|
||||
|
58
Assets/Mirror/Core/NetworkProfiler2020.cs
Normal file
58
Assets/Mirror/Core/NetworkProfiler2020.cs
Normal file
@ -0,0 +1,58 @@
|
||||
// [Obsolete] path for our old Network Profiler because the new one doesn't work with Unity 2020.
|
||||
// we can't change NetworkProfiler, but we can restore the old API with [Obsolete] paths.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Mirror.RemoteCalls;
|
||||
|
||||
namespace Mirror
|
||||
{
|
||||
static class NetworkProfiler2020
|
||||
{
|
||||
public const string ObsoleteMessage = "Obsolete API is only kept for old Network Profiler and Unity 2020 support.";
|
||||
}
|
||||
|
||||
// OBSOLETE PATH FOR OLD NETWORK PROFILER IN UNITY 2020
|
||||
[Obsolete(NetworkProfiler2020.ObsoleteMessage)]
|
||||
public interface IMessageBase{}
|
||||
|
||||
[Obsolete(NetworkProfiler2020.ObsoleteMessage)]
|
||||
public struct SyncEventMessage : NetworkMessage
|
||||
{
|
||||
public ushort functionHash;
|
||||
public uint netId;
|
||||
}
|
||||
|
||||
[Obsolete(NetworkProfiler2020.ObsoleteMessage)]
|
||||
public struct UpdateVarsMessage : NetworkMessage
|
||||
{
|
||||
public uint netId;
|
||||
}
|
||||
|
||||
[Obsolete(NetworkProfiler2020.ObsoleteMessage)]
|
||||
public abstract partial class NetworkBehaviour
|
||||
{
|
||||
public static RemoteCallDelegate GetRpcHandler(int functionHash) =>
|
||||
RemoteProcedureCalls.GetDelegate((ushort)functionHash);
|
||||
}
|
||||
|
||||
[Obsolete(NetworkProfiler2020.ObsoleteMessage)]
|
||||
public sealed partial class NetworkIdentity
|
||||
{
|
||||
public static Dictionary<uint, NetworkIdentity> spawned
|
||||
{
|
||||
get
|
||||
{
|
||||
// server / host mode: use the one from server.
|
||||
// host mode has access to all spawned.
|
||||
if (NetworkServer.active)
|
||||
return NetworkServer.spawned;
|
||||
|
||||
// client
|
||||
if (NetworkClient.active)
|
||||
return NetworkClient.spawned;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Mirror/Core/NetworkProfiler2020.cs.meta
Normal file
3
Assets/Mirror/Core/NetworkProfiler2020.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5684027f2ad43b9863abe03e630bc71
|
||||
timeCreated: 1717679756
|
@ -210,7 +210,7 @@ private GameObject GetSceneObject(ulong sceneId)
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject GetPrefab(Guid assetId)
|
||||
private GameObject GetPrefab(uint assetId)
|
||||
{
|
||||
var networkManager = NetworkManager.singleton;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user