mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
Compare commits
25 Commits
3b75567d78
...
c7b7fbc33e
Author | SHA1 | Date | |
---|---|---|---|
|
c7b7fbc33e | ||
|
451c297a43 | ||
|
1e04c9833b | ||
|
1187a59b18 | ||
|
499e4daea3 | ||
|
04bb95311b | ||
|
e9a8e02a40 | ||
|
bb97db4eaa | ||
|
e7b3aa77df | ||
|
f61524863e | ||
|
af133e6110 | ||
|
a9d280cd4b | ||
|
c4f803fcf6 | ||
|
83fd6cbc20 | ||
|
7821e24789 | ||
|
ceaa63dad1 | ||
|
c719049888 | ||
|
dd4f345cb6 | ||
|
60a186c5f2 | ||
|
035afd140e | ||
|
8df429d474 | ||
|
8de9789faa | ||
|
387be93703 | ||
|
3436df7ca4 | ||
|
668dc91ffb |
2
.github/workflows/RunUnityTests.yml
vendored
2
.github/workflows/RunUnityTests.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
- 2021.3.45f1
|
- 2021.3.45f1
|
||||||
- 2022.3.51f1
|
- 2022.3.51f1
|
||||||
- 2023.2.20f1
|
- 2023.2.20f1
|
||||||
- 6000.0.24f1
|
- 6000.0.25f1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
1501
Assets/Mirror/Components/NetworkTransform/NetworkTransformHybrid.cs
Normal file
1501
Assets/Mirror/Components/NetworkTransform/NetworkTransformHybrid.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8f63ea2e505fd484193fb31c5c55ca73
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -48,28 +48,28 @@ public class TargetRpcAttribute : Attribute
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents clients from running this method.
|
/// Only an active server will run this method.
|
||||||
/// <para>Prints a warning if a client tries to execute this method.</para>
|
/// <para>Prints a warning if a client or in-active server tries to execute this method.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class ServerAttribute : Attribute {}
|
public class ServerAttribute : Attribute {}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents clients from running this method.
|
/// Only an active server will run this method.
|
||||||
/// <para>No warning is thrown.</para>
|
/// <para>No warning is thrown.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class ServerCallbackAttribute : Attribute {}
|
public class ServerCallbackAttribute : Attribute {}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents the server from running this method.
|
/// Only an active client will run this method.
|
||||||
/// <para>Prints a warning if the server tries to execute this method.</para>
|
/// <para>Prints a warning if the server or in-active client tries to execute this method.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public class ClientAttribute : Attribute {}
|
public class ClientAttribute : Attribute {}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents the server from running this method.
|
/// Only an active client will run this method.
|
||||||
/// <para>No warning is printed.</para>
|
/// <para>No warning is printed.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
@ -269,17 +269,52 @@ internal static void ResetClientStatics()
|
|||||||
|
|
||||||
internal static void ResetServerStatics()
|
internal static void ResetServerStatics()
|
||||||
{
|
{
|
||||||
|
reuseNetworkIds = true;
|
||||||
|
reuseDelay = 1;
|
||||||
|
|
||||||
|
netIdQueue.Clear();
|
||||||
nextNetworkId = 1;
|
nextNetworkId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gets the NetworkIdentity from the sceneIds dictionary with the corresponding id</summary>
|
/// <summary>Gets the NetworkIdentity from the sceneIds dictionary with the corresponding id</summary>
|
||||||
public static NetworkIdentity GetSceneIdentity(ulong id) => sceneIds[id];
|
public static NetworkIdentity GetSceneIdentity(ulong id) => sceneIds[id];
|
||||||
|
|
||||||
|
#region Network ID Reuse
|
||||||
|
|
||||||
|
internal static bool reuseNetworkIds = true;
|
||||||
|
internal static byte reuseDelay = 1;
|
||||||
|
|
||||||
|
internal struct ReusableNetworkId
|
||||||
|
{
|
||||||
|
public uint reusableNetId;
|
||||||
|
public double timeAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// pool of NetworkIds that can be reused
|
||||||
|
internal static readonly Queue<ReusableNetworkId> netIdQueue = new Queue<ReusableNetworkId>();
|
||||||
static uint nextNetworkId = 1;
|
static uint nextNetworkId = 1;
|
||||||
internal static uint GetNextNetworkId() => nextNetworkId++;
|
|
||||||
|
internal static uint GetNextNetworkId()
|
||||||
|
{
|
||||||
|
// Older Unity versions don't have TryPeek.
|
||||||
|
if (reuseNetworkIds && netIdQueue.Count > 0 && netIdQueue.Peek().timeAvailable < NetworkTime.time)
|
||||||
|
{
|
||||||
|
ReusableNetworkId nextNetId = netIdQueue.Dequeue();
|
||||||
|
//Debug.LogFormat(LogType.Log, LogOption.NoStacktrace, null, $"[GetNextNetworkId] Reusing NetworkId {nextNetId.reusableNetId}.");
|
||||||
|
return nextNetId.reusableNetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextNetworkId++;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Resets nextNetworkId = 1</summary>
|
/// <summary>Resets nextNetworkId = 1</summary>
|
||||||
public static void ResetNextNetworkId() => nextNetworkId = 1;
|
public static void ResetNextNetworkId()
|
||||||
|
{
|
||||||
|
netIdQueue.Clear();
|
||||||
|
nextNetworkId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>The delegate type for the clientAuthorityCallback.</summary>
|
/// <summary>The delegate type for the clientAuthorityCallback.</summary>
|
||||||
public delegate void ClientAuthorityCallback(NetworkConnectionToClient conn, NetworkIdentity identity, bool authorityState);
|
public delegate void ClientAuthorityCallback(NetworkConnectionToClient conn, NetworkIdentity identity, bool authorityState);
|
||||||
@ -633,6 +668,9 @@ void OnDestroy()
|
|||||||
NetworkServer.Destroy(gameObject);
|
NetworkServer.Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isServer && reuseNetworkIds && netId > 0)
|
||||||
|
netIdQueue.Enqueue(new ReusableNetworkId { reusableNetId = netId, timeAvailable = NetworkTime.time + reuseDelay });
|
||||||
|
|
||||||
if (isLocalPlayer)
|
if (isLocalPlayer)
|
||||||
{
|
{
|
||||||
// previously there was a bug where isLocalPlayer was
|
// previously there was a bug where isLocalPlayer was
|
||||||
@ -671,7 +709,24 @@ void OnDestroy()
|
|||||||
|
|
||||||
// if an identity is still in .spawned, remove it too.
|
// if an identity is still in .spawned, remove it too.
|
||||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3324
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3324
|
||||||
NetworkClient.spawned.Remove(netId);
|
//
|
||||||
|
// however, verify that spawned[netId] is this NetworkIdentity
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3785
|
||||||
|
// - server: netId=42 walks out of and back into AOI range in same frame
|
||||||
|
// - client frame 1:
|
||||||
|
// on_destroymsg(42) -> NetworkClient.DestroyObject -> GameObject.Destroy(42) // next frame
|
||||||
|
// on_spawnmsg(42) -> NetworkClient.SpawnPrefab -> Instantiate(42) -> spawned[42]=new_identity
|
||||||
|
// - client frame 2:
|
||||||
|
// Unity destroys the old 42
|
||||||
|
// NetworkIdentity.OnDestroy removes .spawned[42] which is new_identity not old_identity
|
||||||
|
// new_identity becomes orphaned
|
||||||
|
//
|
||||||
|
// solution: only remove if spawned[netId] is this NetworkIdentity or null
|
||||||
|
if (NetworkClient.spawned.TryGetValue(netId, out NetworkIdentity entry))
|
||||||
|
{
|
||||||
|
if (entry == this || entry == null)
|
||||||
|
NetworkClient.spawned.Remove(netId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// workaround for cyclid NI<->NB reference causing memory leaks
|
// workaround for cyclid NI<->NB reference causing memory leaks
|
||||||
@ -846,7 +901,7 @@ internal void OnStopLocalPlayer()
|
|||||||
for (int i = 0; i < components.Length; ++i)
|
for (int i = 0; i < components.Length; ++i)
|
||||||
{
|
{
|
||||||
NetworkBehaviour component = components[i];
|
NetworkBehaviour component = components[i];
|
||||||
ulong nthBit = (1u << i);
|
ulong nthBit = 1ul << i;
|
||||||
|
|
||||||
bool dirty = component.IsDirty();
|
bool dirty = component.IsDirty();
|
||||||
|
|
||||||
@ -893,7 +948,7 @@ ulong ClientDirtyMask()
|
|||||||
|
|
||||||
// on client, only consider owned components with SyncDirection to server
|
// on client, only consider owned components with SyncDirection to server
|
||||||
NetworkBehaviour component = components[i];
|
NetworkBehaviour component = components[i];
|
||||||
ulong nthBit = (1u << i);
|
ulong nthBit = 1ul << i;
|
||||||
|
|
||||||
if (isOwned && component.syncDirection == SyncDirection.ClientToServer)
|
if (isOwned && component.syncDirection == SyncDirection.ClientToServer)
|
||||||
{
|
{
|
||||||
@ -911,7 +966,7 @@ ulong ClientDirtyMask()
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
internal static bool IsDirty(ulong mask, int index)
|
internal static bool IsDirty(ulong mask, int index)
|
||||||
{
|
{
|
||||||
ulong nthBit = (ulong)(1 << index);
|
ulong nthBit = 1ul << index;
|
||||||
return (mask & nthBit) != 0;
|
return (mask & nthBit) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1310,7 +1365,14 @@ internal void ResetState()
|
|||||||
isOwned = false;
|
isOwned = false;
|
||||||
NotifyAuthority();
|
NotifyAuthority();
|
||||||
|
|
||||||
netId = 0;
|
if (netId > 0)
|
||||||
|
{
|
||||||
|
if (reuseNetworkIds)
|
||||||
|
netIdQueue.Enqueue(new ReusableNetworkId { reusableNetId = netId, timeAvailable = NetworkTime.time + reuseDelay });
|
||||||
|
|
||||||
|
netId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
connectionToServer = null;
|
connectionToServer = null;
|
||||||
connectionToClient = null;
|
connectionToClient = null;
|
||||||
|
|
||||||
|
@ -47,6 +47,13 @@ public class NetworkManager : MonoBehaviour
|
|||||||
// [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")]
|
// [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")]
|
||||||
// public int clientSendRate = 30; // 33 ms
|
// public int clientSendRate = 30; // 33 ms
|
||||||
|
|
||||||
|
[Header("Network ID Reuse")]
|
||||||
|
[Tooltip("Reuse network IDs when objects are unspawned or destroyed?")]
|
||||||
|
public bool reuseNetworkIds = true;
|
||||||
|
[Range(1, 60)]
|
||||||
|
[Tooltip("Delay in seconds before network IDs are reused")]
|
||||||
|
public byte reuseDelay = 1;
|
||||||
|
|
||||||
/// <summary>Automatically switch to this scene upon going offline (on start / on disconnect / on shutdown).</summary>
|
/// <summary>Automatically switch to this scene upon going offline (on start / on disconnect / on shutdown).</summary>
|
||||||
[Header("Scene Management")]
|
[Header("Scene Management")]
|
||||||
[Scene]
|
[Scene]
|
||||||
@ -290,6 +297,10 @@ void SetupServer()
|
|||||||
NetworkServer.disconnectInactiveTimeout = disconnectInactiveTimeout;
|
NetworkServer.disconnectInactiveTimeout = disconnectInactiveTimeout;
|
||||||
NetworkServer.exceptionsDisconnect = exceptionsDisconnect;
|
NetworkServer.exceptionsDisconnect = exceptionsDisconnect;
|
||||||
|
|
||||||
|
// Setup reuseable network IDs
|
||||||
|
NetworkIdentity.reuseNetworkIds = reuseNetworkIds;
|
||||||
|
NetworkIdentity.reuseDelay = reuseDelay;
|
||||||
|
|
||||||
if (runInBackground)
|
if (runInBackground)
|
||||||
Application.runInBackground = true;
|
Application.runInBackground = true;
|
||||||
|
|
||||||
@ -634,31 +645,6 @@ public void StopClient()
|
|||||||
NetworkClient.Disconnect();
|
NetworkClient.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when quitting the application by closing the window / pressing
|
|
||||||
// stop in the editor. virtual so that inheriting classes'
|
|
||||||
// OnApplicationQuit() can call base.OnApplicationQuit() too
|
|
||||||
public virtual void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
// stop client first
|
|
||||||
// (we want to send the quit packet to the server instead of waiting
|
|
||||||
// for a timeout)
|
|
||||||
if (NetworkClient.isConnected)
|
|
||||||
{
|
|
||||||
StopClient();
|
|
||||||
//Debug.Log("OnApplicationQuit: stopped client");
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop server after stopping client (for proper host mode stopping)
|
|
||||||
if (NetworkServer.active)
|
|
||||||
{
|
|
||||||
StopServer();
|
|
||||||
//Debug.Log("OnApplicationQuit: stopped server");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call ResetStatics to reset statics and singleton
|
|
||||||
ResetStatics();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Set the frame rate for a headless builds. Override to disable or modify.</summary>
|
/// <summary>Set the frame rate for a headless builds. Override to disable or modify.</summary>
|
||||||
// useful for dedicated servers.
|
// useful for dedicated servers.
|
||||||
// useful for headless benchmark clients.
|
// useful for headless benchmark clients.
|
||||||
@ -772,12 +758,41 @@ public static void ResetStatics()
|
|||||||
singleton = null;
|
singleton = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual so that inheriting classes' OnDestroy() can call base.OnDestroy() too
|
// called when quitting the application by closing the window / pressing
|
||||||
|
// stop in the editor.
|
||||||
|
// use OnDestroy instead of OnApplicationQuit:
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
public virtual void OnDestroy()
|
public virtual void OnDestroy()
|
||||||
{
|
{
|
||||||
//Debug.Log("NetworkManager destroyed");
|
//Debug.Log("NetworkManager destroyed");
|
||||||
|
|
||||||
|
// stop client first
|
||||||
|
// (we want to send the quit packet to the server instead of waiting
|
||||||
|
// for a timeout)
|
||||||
|
if (NetworkClient.isConnected)
|
||||||
|
{
|
||||||
|
StopClient();
|
||||||
|
//Debug.Log("OnApplicationQuit: stopped client");
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop server after stopping client (for proper host mode stopping)
|
||||||
|
if (NetworkServer.active)
|
||||||
|
{
|
||||||
|
StopServer();
|
||||||
|
//Debug.Log("OnApplicationQuit: stopped server");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call ResetStatics to reset statics and singleton
|
||||||
|
ResetStatics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [Obsolete] in case someone is inheriting it.
|
||||||
|
// don't use this anymore.
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
|
// DEPRECATED 2024-10-29
|
||||||
|
[Obsolete("Override OnDestroy instead of OnApplicationQuit.")]
|
||||||
|
public virtual void OnApplicationQuit() {}
|
||||||
|
|
||||||
/// <summary>The name of the current network scene.</summary>
|
/// <summary>The name of the current network scene.</summary>
|
||||||
// set by NetworkManager when changing the scene.
|
// set by NetworkManager when changing the scene.
|
||||||
// new clients will automatically load this scene.
|
// new clients will automatically load this scene.
|
||||||
|
@ -313,8 +313,6 @@ public static List<T> ReadList<T>(this NetworkReader reader)
|
|||||||
// structs may have .Set<T> members which weaver needs to be able to
|
// structs may have .Set<T> members which weaver needs to be able to
|
||||||
// fully serialize for NetworkMessages etc.
|
// fully serialize for NetworkMessages etc.
|
||||||
// note that Weaver/Readers/GenerateReader() handles this manually.
|
// note that Weaver/Readers/GenerateReader() handles this manually.
|
||||||
// TODO writer not found. need to adjust weaver first. see tests.
|
|
||||||
/*
|
|
||||||
public static HashSet<T> ReadHashSet<T>(this NetworkReader reader)
|
public static HashSet<T> ReadHashSet<T>(this NetworkReader reader)
|
||||||
{
|
{
|
||||||
// we offset count by '1' to easily support null without writing another byte.
|
// we offset count by '1' to easily support null without writing another byte.
|
||||||
@ -334,7 +332,6 @@ public static HashSet<T> ReadHashSet<T>(this NetworkReader reader)
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public static T[] ReadArray<T>(this NetworkReader reader)
|
public static T[] ReadArray<T>(this NetworkReader reader)
|
||||||
{
|
{
|
||||||
|
@ -365,28 +365,25 @@ public static void WriteList<T>(this NetworkWriter writer, List<T> list)
|
|||||||
// structs may have .Set<T> members which weaver needs to be able to
|
// structs may have .Set<T> members which weaver needs to be able to
|
||||||
// fully serialize for NetworkMessages etc.
|
// fully serialize for NetworkMessages etc.
|
||||||
// note that Weaver/Writers/GenerateWriter() handles this manually.
|
// note that Weaver/Writers/GenerateWriter() handles this manually.
|
||||||
// TODO writer not found. need to adjust weaver first. see tests.
|
public static void WriteHashSet<T>(this NetworkWriter writer, HashSet<T> hashSet)
|
||||||
// /*
|
{
|
||||||
// public static void WriteHashSet<T>(this NetworkWriter writer, HashSet<T> hashSet)
|
// we offset count by '1' to easily support null without writing another byte.
|
||||||
// {
|
// encoding null as '0' instead of '-1' also allows for better compression
|
||||||
// // we offset count by '1' to easily support null without writing another byte.
|
// (ushort vs. short / varuint vs. varint) etc.
|
||||||
// // encoding null as '0' instead of '-1' also allows for better compression
|
if (hashSet is null)
|
||||||
// // (ushort vs. short / varuint vs. varint) etc.
|
{
|
||||||
// if (hashSet is null)
|
// most sizes are small, write size as VarUInt!
|
||||||
// {
|
Compression.CompressVarUInt(writer, 0u);
|
||||||
// // most sizes are small, write size as VarUInt!
|
//writer.WriteUInt(0);
|
||||||
// Compression.CompressVarUInt(writer, 0u);
|
return;
|
||||||
// //writer.WriteUInt(0);
|
}
|
||||||
// return;
|
|
||||||
// }
|
// most sizes are small, write size as VarUInt!
|
||||||
//
|
Compression.CompressVarUInt(writer, checked((uint)hashSet.Count) + 1u);
|
||||||
// // most sizes are small, write size as VarUInt!
|
//writer.WriteUInt(checked((uint)hashSet.Count) + 1u);
|
||||||
// Compression.CompressVarUInt(writer, checked((uint)hashSet.Count) + 1u);
|
foreach (T item in hashSet)
|
||||||
// //writer.WriteUInt(checked((uint)hashSet.Count) + 1u);
|
writer.Write(item);
|
||||||
// foreach (T item in hashSet)
|
}
|
||||||
// writer.Write(item);
|
|
||||||
// }
|
|
||||||
// */
|
|
||||||
|
|
||||||
public static void WriteArray<T>(this NetworkWriter writer, T[] array)
|
public static void WriteArray<T>(this NetworkWriter writer, T[] array)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +114,18 @@ public static void SetPositionAndRotation(this Transform transform, Vector3 posi
|
|||||||
transform.position = position;
|
transform.position = position;
|
||||||
transform.rotation = rotation;
|
transform.rotation = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GetLocalPositionAndRotation(this Transform transform, out Vector3 position, out Quaternion rotation)
|
||||||
|
{
|
||||||
|
position = transform.localPosition;
|
||||||
|
rotation = transform.localRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetLocalPositionAndRotation(this Transform transform, Vector3 position, Quaternion rotation)
|
||||||
|
{
|
||||||
|
transform.localPosition = position;
|
||||||
|
transform.localRotation = rotation;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// IPEndPoint address only to pretty string.
|
// IPEndPoint address only to pretty string.
|
||||||
|
@ -196,8 +196,15 @@ public virtual void ServerLateUpdate() {}
|
|||||||
/// <summary>Shut down the transport, both as client and server</summary>
|
/// <summary>Shut down the transport, both as client and server</summary>
|
||||||
public abstract void Shutdown();
|
public abstract void Shutdown();
|
||||||
|
|
||||||
/// <summary>Called by Unity when quitting. Inheriting Transports should call base for proper Shutdown.</summary>
|
// [Obsolete] in case someone is inheriting it.
|
||||||
public virtual void OnApplicationQuit()
|
// don't use this anymore.
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
|
// DEPRECATED 2024-10-29
|
||||||
|
[Obsolete("Override OnDestroy instead of OnApplicationQuit.")]
|
||||||
|
public virtual void OnApplicationQuit() {}
|
||||||
|
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
|
public virtual void OnDestroy()
|
||||||
{
|
{
|
||||||
// stop transport (e.g. to shut down threads)
|
// stop transport (e.g. to shut down threads)
|
||||||
// (when pressing Stop in the Editor, Unity keeps threads alive
|
// (when pressing Stop in the Editor, Unity keeps threads alive
|
||||||
|
@ -113,6 +113,8 @@ public override void OnPreviewGUI(Rect r, GUIStyle background)
|
|||||||
|
|
||||||
Y = DrawObservers(identity, initialX, Y);
|
Y = DrawObservers(identity, initialX, Y);
|
||||||
|
|
||||||
|
Y = DrawNetworkIDQueue(initialX, Y);
|
||||||
|
|
||||||
_ = DrawOwner(identity, initialX, Y);
|
_ = DrawOwner(identity, initialX, Y);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -193,6 +195,25 @@ float DrawObservers(NetworkIdentity identity, float initialX, float Y)
|
|||||||
return Y;
|
return Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float DrawNetworkIDQueue(float initialX, float Y)
|
||||||
|
{
|
||||||
|
if (NetworkIdentity.netIdQueue.Count > 0)
|
||||||
|
{
|
||||||
|
Rect netIdRect = new Rect(initialX, Y + 10, 200, 20);
|
||||||
|
GUI.Label(netIdRect, new GUIContent("Network ID Queue"), styles.labelStyle);
|
||||||
|
netIdRect.x += 20;
|
||||||
|
netIdRect.y += netIdRect.height;
|
||||||
|
foreach (var entry in NetworkIdentity.netIdQueue)
|
||||||
|
{
|
||||||
|
GUI.Label(netIdRect, $"[{entry.reusableNetId}] {entry.timeAvailable:0.000}", styles.componentName);
|
||||||
|
netIdRect.y += netIdRect.height;
|
||||||
|
Y = netIdRect.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Y;
|
||||||
|
}
|
||||||
|
|
||||||
float DrawOwner(NetworkIdentity identity, float initialX, float Y)
|
float DrawOwner(NetworkIdentity identity, float initialX, float Y)
|
||||||
{
|
{
|
||||||
if (identity.connectionToClient != null)
|
if (identity.connectionToClient != null)
|
||||||
|
@ -125,6 +125,13 @@ MethodReference GenerateReader(TypeReference variableReference, ref bool Weaving
|
|||||||
|
|
||||||
return GenerateReadCollection(variableReference, elementType, nameof(NetworkReaderExtensions.ReadList), ref WeavingFailed);
|
return GenerateReadCollection(variableReference, elementType, nameof(NetworkReaderExtensions.ReadList), ref WeavingFailed);
|
||||||
}
|
}
|
||||||
|
else if (variableDefinition.Is(typeof(HashSet<>)))
|
||||||
|
{
|
||||||
|
GenericInstanceType genericInstance = (GenericInstanceType)variableReference;
|
||||||
|
TypeReference elementType = genericInstance.GenericArguments[0];
|
||||||
|
|
||||||
|
return GenerateReadCollection(variableReference, elementType, nameof(NetworkReaderExtensions.ReadHashSet), ref WeavingFailed);
|
||||||
|
}
|
||||||
// handle both NetworkBehaviour and inheritors.
|
// handle both NetworkBehaviour and inheritors.
|
||||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
||||||
else if (variableReference.IsDerivedFrom<NetworkBehaviour>() || variableReference.Is<NetworkBehaviour>())
|
else if (variableReference.IsDerivedFrom<NetworkBehaviour>() || variableReference.Is<NetworkBehaviour>())
|
||||||
|
@ -126,6 +126,13 @@ MethodReference GenerateWriter(TypeReference variableReference, ref bool Weaving
|
|||||||
|
|
||||||
return GenerateCollectionWriter(variableReference, elementType, nameof(NetworkWriterExtensions.WriteList), ref WeavingFailed);
|
return GenerateCollectionWriter(variableReference, elementType, nameof(NetworkWriterExtensions.WriteList), ref WeavingFailed);
|
||||||
}
|
}
|
||||||
|
if (variableReference.Is(typeof(HashSet<>)))
|
||||||
|
{
|
||||||
|
GenericInstanceType genericInstance = (GenericInstanceType)variableReference;
|
||||||
|
TypeReference elementType = genericInstance.GenericArguments[0];
|
||||||
|
|
||||||
|
return GenerateCollectionWriter(variableReference, elementType, nameof(NetworkWriterExtensions.WriteHashSet), ref WeavingFailed);
|
||||||
|
}
|
||||||
|
|
||||||
// handle both NetworkBehaviour and inheritors.
|
// handle both NetworkBehaviour and inheritors.
|
||||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
||||||
|
@ -62,15 +62,6 @@ public override void LateUpdate()
|
|||||||
base.LateUpdate();
|
base.LateUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Runs on both Server and Client
|
|
||||||
/// </summary>
|
|
||||||
public override void OnDestroy()
|
|
||||||
{
|
|
||||||
base.OnDestroy();
|
|
||||||
//UnityEngine.Debug.Log("OnDestroy");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Start & Stop
|
#region Start & Stop
|
||||||
@ -87,10 +78,10 @@ public override void ConfigureHeadlessFrameRate()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
/// called when quitting the application by closing the window / pressing stop in the editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void OnApplicationQuit()
|
public override void OnDestroy()
|
||||||
{
|
{
|
||||||
base.OnApplicationQuit();
|
base.OnDestroy();
|
||||||
//UnityEngine.Debug.Log("OnApplicationQuit");
|
//UnityEngine.Debug.Log("OnDestroy");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,5 +1,111 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2505838817581327622
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8070823805368028938}
|
||||||
|
- component: {fileID: 9066655185906928051}
|
||||||
|
- component: {fileID: 4760233786622638652}
|
||||||
|
- component: {fileID: 2239866139065920034}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8070823805368028938
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.4999999, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 5650773562400175449}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &9066655185906928051
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &4760233786622638652
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_Text: RB Reliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967040
|
||||||
|
--- !u!114 &2239866139065920034
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &3564599214188516024
|
--- !u!1 &3564599214188516024
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -194,6 +300,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4320229852458648655}
|
- {fileID: 4320229852458648655}
|
||||||
|
- {fileID: 8070823805368028938}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -1,5 +1,111 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1900176203039934355
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4129545300081926521}
|
||||||
|
- component: {fileID: 6572775962608386051}
|
||||||
|
- component: {fileID: 3912971638250293984}
|
||||||
|
- component: {fileID: 4630973873820678624}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &4129545300081926521
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.4999999, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 6814142693731383418}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &6572775962608386051
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &3912971638250293984
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_Text: RB Unreliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4278255615
|
||||||
|
--- !u!114 &4630973873820678624
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &2414815785185615771
|
--- !u!1 &2414815785185615771
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -194,6 +300,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3102887894851733868}
|
- {fileID: 3102887894851733868}
|
||||||
|
- {fileID: 4129545300081926521}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -79,6 +79,112 @@ MeshRenderer:
|
|||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
|
--- !u!1 &5366675989284536270
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1545974004720046327}
|
||||||
|
- component: {fileID: 1128890847761595466}
|
||||||
|
- component: {fileID: 396193860522376263}
|
||||||
|
- component: {fileID: 6075803386746488465}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1545974004720046327
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.5, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &1128890847761595466
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &396193860522376263
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_Text: Reliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967040
|
||||||
|
--- !u!114 &6075803386746488465
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &5844787331012650587
|
--- !u!1 &5844787331012650587
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -195,6 +301,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3834521907656645861}
|
- {fileID: 3834521907656645861}
|
||||||
|
- {fileID: 1545974004720046327}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -71,14 +71,6 @@ public override void ConfigureHeadlessFrameRate()
|
|||||||
base.ConfigureHeadlessFrameRate();
|
base.ConfigureHeadlessFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
|
||||||
/// </summary>
|
|
||||||
public override void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
base.OnApplicationQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene Management
|
#region Scene Management
|
||||||
|
@ -159,6 +159,112 @@ MeshRenderer:
|
|||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
|
--- !u!1 &7554601580530514207
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8679949096303753939}
|
||||||
|
- component: {fileID: 3142866354055383265}
|
||||||
|
- component: {fileID: 8297296856940116434}
|
||||||
|
- component: {fileID: 1123801447343694564}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8679949096303753939
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.4999999, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &3142866354055383265
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &8297296856940116434
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_Text: Unreliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4278255615
|
||||||
|
--- !u!114 &1123801447343694564
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &7863680369626900553
|
--- !u!1 &7863680369626900553
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -195,6 +301,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3834521907656645861}
|
- {fileID: 3834521907656645861}
|
||||||
|
- {fileID: 8679949096303753939}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -38,6 +38,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 702109291309605218}
|
- {fileID: 702109291309605218}
|
||||||
|
- {fileID: 1245118046271587945}
|
||||||
- {fileID: 8174595063106582951}
|
- {fileID: 8174595063106582951}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -197,7 +198,6 @@ MonoBehaviour:
|
|||||||
maxTurnSpeed: 100
|
maxTurnSpeed: 100
|
||||||
turnAcceleration: 3
|
turnAcceleration: 3
|
||||||
runtimeData:
|
runtimeData:
|
||||||
_horizontal: 0
|
|
||||||
_vertical: 0
|
_vertical: 0
|
||||||
_turnSpeed: 0
|
_turnSpeed: 0
|
||||||
_animVelocity: 0
|
_animVelocity: 0
|
||||||
@ -328,6 +328,112 @@ MonoBehaviour:
|
|||||||
rotationSensitivity: 0.01
|
rotationSensitivity: 0.01
|
||||||
positionPrecision: 0.01
|
positionPrecision: 0.01
|
||||||
scalePrecision: 0.01
|
scalePrecision: 0.01
|
||||||
|
--- !u!1 &8370326626297540303
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1245118046271587945}
|
||||||
|
- component: {fileID: 2132579043257509693}
|
||||||
|
- component: {fileID: 7297775110981071875}
|
||||||
|
- component: {fileID: 755026988438523126}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1245118046271587945
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 4.5, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &2132579043257509693
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &7297775110981071875
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_Text: Reliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967040
|
||||||
|
--- !u!114 &755026988438523126
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &9109672380512621037
|
--- !u!1 &9109672380512621037
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -359,7 +465,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4659514702152478195}
|
m_Father: {fileID: 4659514702152478195}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!23 &4153780752967283830
|
--- !u!23 &4153780752967283830
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
@ -446,6 +552,11 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: BasePrefab
|
value: BasePrefab
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
|
@ -38,6 +38,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 702109291309605218}
|
- {fileID: 702109291309605218}
|
||||||
|
- {fileID: 3980373565918037634}
|
||||||
- {fileID: 8174595063106582951}
|
- {fileID: 8174595063106582951}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -197,7 +198,6 @@ MonoBehaviour:
|
|||||||
maxTurnSpeed: 100
|
maxTurnSpeed: 100
|
||||||
turnAcceleration: 3
|
turnAcceleration: 3
|
||||||
runtimeData:
|
runtimeData:
|
||||||
_horizontal: 0
|
|
||||||
_vertical: 0
|
_vertical: 0
|
||||||
_turnSpeed: 0
|
_turnSpeed: 0
|
||||||
_animVelocity: 0
|
_animVelocity: 0
|
||||||
@ -328,6 +328,112 @@ MonoBehaviour:
|
|||||||
positionSensitivity: 0.01
|
positionSensitivity: 0.01
|
||||||
rotationSensitivity: 0.01
|
rotationSensitivity: 0.01
|
||||||
scaleSensitivity: 0.01
|
scaleSensitivity: 0.01
|
||||||
|
--- !u!1 &8921157218750951074
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3980373565918037634}
|
||||||
|
- component: {fileID: 6676747655999921495}
|
||||||
|
- component: {fileID: 2065557788844610204}
|
||||||
|
- component: {fileID: 7150452883383585942}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3980373565918037634
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 4.5, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &6676747655999921495
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &2065557788844610204
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_Text: Unreliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4278255615
|
||||||
|
--- !u!114 &7150452883383585942
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &9109672380512621037
|
--- !u!1 &9109672380512621037
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -359,7 +465,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4659514702152478195}
|
m_Father: {fileID: 4659514702152478195}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!23 &4153780752967283830
|
--- !u!23 &4153780752967283830
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
@ -446,6 +552,11 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: BasePrefab
|
value: BasePrefab
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
|
@ -19,11 +19,6 @@ void Awake()
|
|||||||
mainCam = Camera.main;
|
mainCam = Camera.main;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDisable()
|
|
||||||
{
|
|
||||||
//Debug.Log("PlayerCamera.OnDisable");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnStartLocalPlayer()
|
public override void OnStartLocalPlayer()
|
||||||
{
|
{
|
||||||
if (mainCam != null)
|
if (mainCam != null)
|
||||||
@ -38,16 +33,46 @@ public override void OnStartLocalPlayer()
|
|||||||
Debug.LogWarning("PlayerCamera: Could not find a camera in scene with 'MainCamera' tag.");
|
Debug.LogWarning("PlayerCamera: Could not find a camera in scene with 'MainCamera' tag.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnApplicationQuit");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnStopLocalPlayer()
|
public override void OnStopLocalPlayer()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnStopLocalPlayer");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDisable()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnDisable");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnDestroy");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReleaseCamera()
|
||||||
{
|
{
|
||||||
if (mainCam != null && mainCam.transform.parent == transform)
|
if (mainCam != null && mainCam.transform.parent == transform)
|
||||||
{
|
{
|
||||||
|
//Debug.Log("PlayerCamera.ReleaseCamera");
|
||||||
|
|
||||||
mainCam.transform.SetParent(null);
|
mainCam.transform.SetParent(null);
|
||||||
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
|
|
||||||
mainCam.orthographic = true;
|
mainCam.orthographic = true;
|
||||||
mainCam.orthographicSize = 15f;
|
mainCam.orthographicSize = 15f;
|
||||||
mainCam.transform.localPosition = new Vector3(0f, 70f, 0f);
|
mainCam.transform.localPosition = new Vector3(0f, 70f, 0f);
|
||||||
mainCam.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
|
mainCam.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
|
||||||
|
|
||||||
|
if (mainCam.gameObject.scene != SceneManager.GetActiveScene())
|
||||||
|
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
|
||||||
|
|
||||||
|
mainCam = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// base class for networking tests to make things easier.
|
// base class for networking tests to make things easier.
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -81,6 +82,18 @@ protected void CreateNetworked(out GameObject go, out NetworkIdentity identity)
|
|||||||
instantiated.Add(go);
|
instantiated.Add(go);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void CreateNetworked(out GameObject go, out NetworkIdentity identity, Action<NetworkIdentity> preAwake)
|
||||||
|
{
|
||||||
|
go = new GameObject();
|
||||||
|
identity = go.AddComponent<NetworkIdentity>();
|
||||||
|
preAwake(identity);
|
||||||
|
// Awake is only called in play mode.
|
||||||
|
// call manually for initialization.
|
||||||
|
identity.Awake();
|
||||||
|
// track
|
||||||
|
instantiated.Add(go);
|
||||||
|
}
|
||||||
|
|
||||||
// create GameObject + NetworkIdentity + NetworkBehaviour<T>
|
// create GameObject + NetworkIdentity + NetworkBehaviour<T>
|
||||||
// add to tracker list if needed (useful for cleanups afterwards)
|
// add to tracker list if needed (useful for cleanups afterwards)
|
||||||
protected void CreateNetworked<T>(out GameObject go, out NetworkIdentity identity, out T component)
|
protected void CreateNetworked<T>(out GameObject go, out NetworkIdentity identity, out T component)
|
||||||
@ -269,6 +282,44 @@ protected void CreateNetworkedAndSpawn(
|
|||||||
Assert.That(NetworkClient.spawned.ContainsKey(serverIdentity.netId));
|
Assert.That(NetworkClient.spawned.ContainsKey(serverIdentity.netId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN
|
||||||
|
// => preAwake callbacks can be used to add network behaviours to the NI
|
||||||
|
// => ownerConnection can be NetworkServer.localConnection if needed.
|
||||||
|
// => returns objects from client and from server.
|
||||||
|
// will be same in host mode.
|
||||||
|
protected void CreateNetworkedAndSpawn(
|
||||||
|
out GameObject serverGO, out NetworkIdentity serverIdentity, Action<NetworkIdentity> serverPreAwake,
|
||||||
|
out GameObject clientGO, out NetworkIdentity clientIdentity, Action<NetworkIdentity> clientPreAwake,
|
||||||
|
NetworkConnectionToClient ownerConnection = null)
|
||||||
|
{
|
||||||
|
// server & client need to be active before spawning
|
||||||
|
Debug.Assert(NetworkClient.active, "NetworkClient needs to be active before spawning.");
|
||||||
|
Debug.Assert(NetworkServer.active, "NetworkServer needs to be active before spawning.");
|
||||||
|
|
||||||
|
// create one on server, one on client
|
||||||
|
// (spawning has to find it on client, it doesn't create it)
|
||||||
|
CreateNetworked(out serverGO, out serverIdentity, serverPreAwake);
|
||||||
|
CreateNetworked(out clientGO, out clientIdentity, clientPreAwake);
|
||||||
|
|
||||||
|
// give both a scene id and register it on client for spawnables
|
||||||
|
clientIdentity.sceneId = serverIdentity.sceneId = (ulong)serverGO.GetHashCode();
|
||||||
|
NetworkClient.spawnableObjects[clientIdentity.sceneId] = clientIdentity;
|
||||||
|
|
||||||
|
// spawn
|
||||||
|
NetworkServer.Spawn(serverGO, ownerConnection);
|
||||||
|
ProcessMessages();
|
||||||
|
|
||||||
|
// double check isServer/isClient. avoids debugging headaches.
|
||||||
|
Assert.That(serverIdentity.isServer, Is.True);
|
||||||
|
Assert.That(clientIdentity.isClient, Is.True);
|
||||||
|
|
||||||
|
// double check that we have authority if we passed an owner connection
|
||||||
|
if (ownerConnection != null)
|
||||||
|
Debug.Assert(clientIdentity.isOwned == true, $"Behaviour Had Wrong Authority when spawned, This means that the test is broken and will give the wrong results");
|
||||||
|
|
||||||
|
// make sure the client really spawned it.
|
||||||
|
Assert.That(NetworkClient.spawned.ContainsKey(serverIdentity.netId));
|
||||||
|
}
|
||||||
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN
|
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN
|
||||||
// => ownerConnection can be NetworkServer.localConnection if needed.
|
// => ownerConnection can be NetworkServer.localConnection if needed.
|
||||||
protected void CreateNetworkedAndSpawn<T>(out GameObject go, out NetworkIdentity identity, out T component, NetworkConnectionToClient ownerConnection = null)
|
protected void CreateNetworkedAndSpawn<T>(out GameObject go, out NetworkIdentity identity, out T component, NetworkConnectionToClient ownerConnection = null)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// OnDe/SerializeSafely tests.
|
// OnDe/SerializeSafely tests.
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Mirror.Tests.EditorBehaviours.NetworkIdentities;
|
using Mirror.Tests.EditorBehaviours.NetworkIdentities;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -42,7 +43,7 @@ public void SerializeAndDeserializeAll()
|
|||||||
);
|
);
|
||||||
|
|
||||||
// set sync modes
|
// set sync modes
|
||||||
serverOwnerComp.syncMode = clientOwnerComp.syncMode = SyncMode.Owner;
|
serverOwnerComp.syncMode = clientOwnerComp.syncMode = SyncMode.Owner;
|
||||||
serverObserversComp.syncMode = clientObserversComp.syncMode = SyncMode.Observers;
|
serverObserversComp.syncMode = clientObserversComp.syncMode = SyncMode.Observers;
|
||||||
|
|
||||||
// set unique values on server components
|
// set unique values on server components
|
||||||
@ -65,10 +66,127 @@ public void SerializeAndDeserializeAll()
|
|||||||
// deserialize client object with OBSERVERS payload
|
// deserialize client object with OBSERVERS payload
|
||||||
reader = new NetworkReader(observersWriter.ToArray());
|
reader = new NetworkReader(observersWriter.ToArray());
|
||||||
clientIdentity.DeserializeClient(reader, true);
|
clientIdentity.DeserializeClient(reader, true);
|
||||||
Assert.That(clientOwnerComp.value, Is.EqualTo(null)); // owner mode shouldn't be in data
|
Assert.That(clientOwnerComp.value, Is.EqualTo(null)); // owner mode shouldn't be in data
|
||||||
Assert.That(clientObserversComp.value, Is.EqualTo(42)); // observers mode should be in data
|
Assert.That(clientObserversComp.value, Is.EqualTo(42)); // observers mode should be in data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test serialize -> deserialize of any supported number of components
|
||||||
|
[Test]
|
||||||
|
public void SerializeAndDeserializeN([NUnit.Framework.Range(1, 64)] int numberOfNBs)
|
||||||
|
{
|
||||||
|
List<SerializeTest1NetworkBehaviour> serverNBs = new List<SerializeTest1NetworkBehaviour>();
|
||||||
|
List<SerializeTest1NetworkBehaviour> clientNBs = new List<SerializeTest1NetworkBehaviour>();
|
||||||
|
// need two of both versions so we can serialize -> deserialize
|
||||||
|
CreateNetworkedAndSpawn(
|
||||||
|
out _, out NetworkIdentity serverIdentity, ni =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < numberOfNBs; i++)
|
||||||
|
{
|
||||||
|
SerializeTest1NetworkBehaviour nb = ni.gameObject.AddComponent<SerializeTest1NetworkBehaviour>();
|
||||||
|
nb.syncInterval = 0;
|
||||||
|
nb.syncMode = SyncMode.Observers;
|
||||||
|
serverNBs.Add(nb);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
out _, out NetworkIdentity clientIdentity, ni =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < numberOfNBs; i++)
|
||||||
|
{
|
||||||
|
SerializeTest1NetworkBehaviour nb = ni.gameObject.AddComponent<SerializeTest1NetworkBehaviour>();
|
||||||
|
nb.syncInterval = 0;
|
||||||
|
nb.syncMode = SyncMode.Observers;
|
||||||
|
clientNBs.Add(nb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// INITIAL SYNC
|
||||||
|
// set unique values on server components
|
||||||
|
for (int i = 0; i < serverNBs.Count; i++)
|
||||||
|
{
|
||||||
|
serverNBs[i].value = (i + 1) * 3;
|
||||||
|
serverNBs[i].SetDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// serialize server object
|
||||||
|
serverIdentity.SerializeServer(true, ownerWriter, observersWriter);
|
||||||
|
|
||||||
|
// deserialize client object with OBSERVERS payload
|
||||||
|
NetworkReader reader = new NetworkReader(observersWriter.ToArray());
|
||||||
|
clientIdentity.DeserializeClient(reader, true);
|
||||||
|
for (int i = 0; i < clientNBs.Count; i++)
|
||||||
|
{
|
||||||
|
int expected = (i + 1) * 3;
|
||||||
|
Assert.That(clientNBs[i].value, Is.EqualTo(expected), $"Expected the clientNBs[{i}] to have a value of {expected}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear dirty bits for incremental sync
|
||||||
|
foreach (SerializeTest1NetworkBehaviour serverNB in serverNBs)
|
||||||
|
serverNB.ClearAllDirtyBits();
|
||||||
|
|
||||||
|
// INCREMENTAL SYNC ALL
|
||||||
|
// set unique values on server components
|
||||||
|
for (int i = 0; i < serverNBs.Count; i++)
|
||||||
|
{
|
||||||
|
serverNBs[i].value = (i + 1) * 11;
|
||||||
|
serverNBs[i].SetDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
ownerWriter.Reset();
|
||||||
|
observersWriter.Reset();
|
||||||
|
// serialize server object
|
||||||
|
serverIdentity.SerializeServer(false, ownerWriter, observersWriter);
|
||||||
|
|
||||||
|
// deserialize client object with OBSERVERS payload
|
||||||
|
reader = new NetworkReader(observersWriter.ToArray());
|
||||||
|
clientIdentity.DeserializeClient(reader, false);
|
||||||
|
for (int i = 0; i < clientNBs.Count; i++)
|
||||||
|
{
|
||||||
|
int expected = (i + 1) * 11;
|
||||||
|
Assert.That(clientNBs[i].value, Is.EqualTo(expected), $"Expected the clientNBs[{i}] to have a value of {expected}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear dirty bits for incremental sync
|
||||||
|
foreach (SerializeTest1NetworkBehaviour serverNB in serverNBs)
|
||||||
|
serverNB.ClearAllDirtyBits();
|
||||||
|
|
||||||
|
// INCREMENTAL SYNC INDIVIDUAL
|
||||||
|
for (int i = 0; i < numberOfNBs; i++)
|
||||||
|
{
|
||||||
|
// reset all client nbs
|
||||||
|
foreach (SerializeTest1NetworkBehaviour clientNB in clientNBs)
|
||||||
|
clientNB.value = 0;
|
||||||
|
|
||||||
|
int expected = (i + 1) * 7;
|
||||||
|
|
||||||
|
// set unique value on server components
|
||||||
|
serverNBs[i].value = expected;
|
||||||
|
serverNBs[i].SetDirty();
|
||||||
|
|
||||||
|
ownerWriter.Reset();
|
||||||
|
observersWriter.Reset();
|
||||||
|
// serialize server object
|
||||||
|
serverIdentity.SerializeServer(false, ownerWriter, observersWriter);
|
||||||
|
|
||||||
|
// deserialize client object with OBSERVERS payload
|
||||||
|
reader = new NetworkReader(observersWriter.ToArray());
|
||||||
|
clientIdentity.DeserializeClient(reader, false);
|
||||||
|
for (int index = 0; index < clientNBs.Count; index++)
|
||||||
|
{
|
||||||
|
SerializeTest1NetworkBehaviour clientNB = clientNBs[index];
|
||||||
|
if (index == i)
|
||||||
|
{
|
||||||
|
Assert.That(clientNB.value, Is.EqualTo(expected), $"Expected the clientNBs[{index}] to have a value of {expected}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.That(clientNB.value, Is.EqualTo(0), $"Expected the clientNBs[{index}] to have a value of 0 since we're not syncing that index (on sync of #{i})");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// serialization should work even if a component throws an exception.
|
// serialization should work even if a component throws an exception.
|
||||||
// so if first component throws, second should still be serialized fine.
|
// so if first component throws, second should still be serialized fine.
|
||||||
[Test]
|
[Test]
|
||||||
@ -150,20 +268,20 @@ public void TooManyComponents()
|
|||||||
public void ErrorCorrection()
|
public void ErrorCorrection()
|
||||||
{
|
{
|
||||||
int original = 0x12345678;
|
int original = 0x12345678;
|
||||||
byte safety = 0x78; // last byte
|
byte safety = 0x78; // last byte
|
||||||
|
|
||||||
// correct size shouldn't be corrected
|
// correct size shouldn't be corrected
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original + 0, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original + 0, safety), Is.EqualTo(original));
|
||||||
|
|
||||||
// read a little too much
|
// read a little too much
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original + 1, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original + 1, safety), Is.EqualTo(original));
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original + 2, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original + 2, safety), Is.EqualTo(original));
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original + 42, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original + 42, safety), Is.EqualTo(original));
|
||||||
|
|
||||||
// read a little too less
|
// read a little too less
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original - 1, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original - 1, safety), Is.EqualTo(original));
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original - 2, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original - 2, safety), Is.EqualTo(original));
|
||||||
Assert.That(NetworkBehaviour.ErrorCorrection(original - 42, safety), Is.EqualTo(original));
|
Assert.That(NetworkBehaviour.ErrorCorrection(original - 42, safety), Is.EqualTo(original));
|
||||||
|
|
||||||
// reading way too much / less is expected to fail.
|
// reading way too much / less is expected to fail.
|
||||||
// we can only correct the last byte, not more.
|
// we can only correct the last byte, not more.
|
||||||
|
@ -1341,7 +1341,15 @@ public void TestNullList()
|
|||||||
Assert.That(readList, Is.Null);
|
Assert.That(readList, Is.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Ignore("TODO")]
|
// writer.Write<T> for HashSet only works if it's actually used by weaver somewhere.
|
||||||
|
// so for TestHashSet() to pass, we need to pretend using a HashSet<int> somewhere.
|
||||||
|
class HashSetNetworkBehaviour : NetworkBehaviour
|
||||||
|
{
|
||||||
|
[Command]
|
||||||
|
public void CmdHashSet(HashSet<int> hashSet) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test] // requires HashSetNetworkBehaviour to exits!
|
||||||
public void TestHashSet()
|
public void TestHashSet()
|
||||||
{
|
{
|
||||||
HashSet<int> original = new HashSet<int>() { 1, 2, 3, 4, 5 };
|
HashSet<int> original = new HashSet<int>() { 1, 2, 3, 4, 5 };
|
||||||
@ -1353,7 +1361,7 @@ public void TestHashSet()
|
|||||||
Assert.That(readHashSet, Is.EqualTo(original));
|
Assert.That(readHashSet, Is.EqualTo(original));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Ignore("TODO")]
|
[Test] // requires HashSetNetworkBehaviour to exits!
|
||||||
public void TestNullHashSet()
|
public void TestNullHashSet()
|
||||||
{
|
{
|
||||||
NetworkWriter writer = new NetworkWriter();
|
NetworkWriter writer = new NetworkWriter();
|
||||||
|
@ -323,7 +323,7 @@ public void SetServerLobbyParams(LobbyCreateRequest request)
|
|||||||
_request = request;
|
_request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
public override void OnDestroy()
|
||||||
{
|
{
|
||||||
// attempt to clean up lobbies, if active
|
// attempt to clean up lobbies, if active
|
||||||
if (NetworkServer.active)
|
if (NetworkServer.active)
|
||||||
@ -340,6 +340,8 @@ private void OnDestroy()
|
|||||||
// sorry. this can go once the lobby service can timeout lobbies itself
|
// sorry. this can go once the lobby service can timeout lobbies itself
|
||||||
Thread.Sleep(300);
|
Thread.Sleep(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,11 +197,10 @@ void EnsureThread()
|
|||||||
Debug.Log($"ThreadedTransport: started worker thread!");
|
Debug.Log($"ThreadedTransport: started worker thread!");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDestroy()
|
public override void OnDestroy()
|
||||||
{
|
{
|
||||||
// stop thread fully
|
// stop thread fully
|
||||||
Shutdown();
|
base.OnDestroy();
|
||||||
|
|
||||||
// TODO recycle writers.
|
// TODO recycle writers.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,14 +68,6 @@ public class #SCRIPTNAME# : NetworkManager
|
|||||||
base.ConfigureHeadlessFrameRate();
|
base.ConfigureHeadlessFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
|
||||||
/// </summary>
|
|
||||||
public override void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
base.OnApplicationQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene Management
|
#region Scene Management
|
||||||
|
@ -15,8 +15,6 @@ public class #SCRIPTNAME# : NetworkManager
|
|||||||
public event Action OnStartAction;
|
public event Action OnStartAction;
|
||||||
public event Action OnDestroyAction;
|
public event Action OnDestroyAction;
|
||||||
|
|
||||||
public event Action OnApplicationQuitAction;
|
|
||||||
|
|
||||||
public event Action<string> ServerChangeSceneAction;
|
public event Action<string> ServerChangeSceneAction;
|
||||||
public event Action<string> OnServerChangeSceneAction;
|
public event Action<string> OnServerChangeSceneAction;
|
||||||
public event Action<string> OnServerSceneChangedAction;
|
public event Action<string> OnServerSceneChangedAction;
|
||||||
@ -117,15 +115,6 @@ public class #SCRIPTNAME# : NetworkManager
|
|||||||
base.ConfigureHeadlessFrameRate();
|
base.ConfigureHeadlessFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
|
||||||
/// </summary>
|
|
||||||
public override void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
OnApplicationQuitAction?.Invoke();
|
|
||||||
base.OnApplicationQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene Management
|
#region Scene Management
|
||||||
|
Loading…
Reference in New Issue
Block a user