Compare commits

...

5 Commits

Author SHA1 Message Date
mischa
bfb8998846
Merge 3df73ea9f1 into 04bb95311b 2024-11-05 14:59:11 +00:00
miwarnec
3df73ea9f1 feat(Profiling): NetworkLoop sampling instead of "UpdateFunction.Invoke" 2024-11-05 15:58:59 +01:00
MrGadget
04bb95311b fix(PlayerTest): Added PlayerName labels to prefabs
Some checks failed
Main / Run Unity Tests (push) Has been cancelled
Main / Semantic Release (push) Has been cancelled
Main / Delete Old Workflow Runs (push) Has been cancelled
2024-11-02 18:30:10 -04:00
MrGadget
e9a8e02a40 fix(PlayerCamera): Improved cleanup
- avoids error in editor
2024-11-02 18:29:05 -04:00
MrGadget
bb97db4eaa chore(CI): RunUnityTests - updated unityVersion 2024-11-01 15:05:14 -04:00
11 changed files with 742 additions and 11 deletions

View File

@ -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

View File

@ -3,6 +3,7 @@
using System.Linq; using System.Linq;
using Mirror.RemoteCalls; using Mirror.RemoteCalls;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling;
namespace Mirror namespace Mirror
{ {
@ -1500,8 +1501,11 @@ internal static void ChangeOwner(NetworkIdentity identity, ChangeOwnerMessage me
internal static void NetworkEarlyUpdate() internal static void NetworkEarlyUpdate()
{ {
// process all incoming messages first before updating the world // process all incoming messages first before updating the world
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkClient: Transport Processing");
if (Transport.active != null) if (Transport.active != null)
Transport.active.ClientEarlyUpdate(); Transport.active.ClientEarlyUpdate();
Profiler.EndSample();
// time snapshot interpolation // time snapshot interpolation
UpdateTimeInterpolation(); UpdateTimeInterpolation();
@ -1532,7 +1536,10 @@ internal static void NetworkLateUpdate()
bool sendIntervalElapsed = AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime); bool sendIntervalElapsed = AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime);
if (!Application.isPlaying || sendIntervalElapsed) if (!Application.isPlaying || sendIntervalElapsed)
{ {
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkClient: Broadcast");
Broadcast(); Broadcast();
Profiler.EndSample();
} }
UpdateConnectionQuality(); UpdateConnectionQuality();
@ -1589,8 +1596,11 @@ void UpdateConnectionQuality()
} }
// process all outgoing messages after updating the world // process all outgoing messages after updating the world
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkClient: Transport Flush");
if (Transport.active != null) if (Transport.active != null)
Transport.active.ClientLateUpdate(); Transport.active.ClientLateUpdate();
Profiler.EndSample();
} }
// broadcast /////////////////////////////////////////////////////////// // broadcast ///////////////////////////////////////////////////////////
@ -1628,7 +1638,11 @@ static void BroadcastToServer()
{ {
// get serialization for this entity viewed by this connection // get serialization for this entity viewed by this connection
// (if anything was serialized this time) // (if anything was serialized this time)
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("BroadcastToServer: SerializeClient");
identity.SerializeClient(writer); identity.SerializeClient(writer);
Profiler.EndSample();
if (writer.Position > 0) if (writer.Position > 0)
{ {
// send state update message // send state update message
@ -1637,7 +1651,11 @@ static void BroadcastToServer()
netId = identity.netId, netId = identity.netId,
payload = writer.ToArraySegment() payload = writer.ToArraySegment()
}; };
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("BroadcastToServer: Flush");
Send(message); Send(message);
Profiler.EndSample();
} }
} }
} }

View File

@ -28,6 +28,7 @@
using UnityEngine; using UnityEngine;
using UnityEngine.LowLevel; using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop; using UnityEngine.PlayerLoop;
using UnityEngine.Profiling;
namespace Mirror namespace Mirror
{ {
@ -187,12 +188,17 @@ static void NetworkEarlyUpdate()
// however, we only want to call NetworkServer/Client in play mode. // however, we only want to call NetworkServer/Client in play mode.
if (!Application.isPlaying) return; if (!Application.isPlaying) return;
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke"
Profiler.BeginSample("NetworkEarlyUpdate");
NetworkTime.EarlyUpdate(); NetworkTime.EarlyUpdate();
//Debug.Log($"NetworkEarlyUpdate {Time.time}"); //Debug.Log($"NetworkEarlyUpdate {Time.time}");
NetworkServer.NetworkEarlyUpdate(); NetworkServer.NetworkEarlyUpdate();
NetworkClient.NetworkEarlyUpdate(); NetworkClient.NetworkEarlyUpdate();
// invoke event after mirror has done it's early updating. // invoke event after mirror has done it's early updating.
OnEarlyUpdate?.Invoke(); OnEarlyUpdate?.Invoke();
Profiler.EndSample();
} }
static void NetworkLateUpdate() static void NetworkLateUpdate()
@ -201,11 +207,16 @@ static void NetworkLateUpdate()
// however, we only want to call NetworkServer/Client in play mode. // however, we only want to call NetworkServer/Client in play mode.
if (!Application.isPlaying) return; if (!Application.isPlaying) return;
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke"
Profiler.BeginSample("NetworkLateUpdate");
//Debug.Log($"NetworkLateUpdate {Time.time}"); //Debug.Log($"NetworkLateUpdate {Time.time}");
// invoke event before mirror does its final late updating. // invoke event before mirror does its final late updating.
OnLateUpdate?.Invoke(); OnLateUpdate?.Invoke();
NetworkServer.NetworkLateUpdate(); NetworkServer.NetworkLateUpdate();
NetworkClient.NetworkLateUpdate(); NetworkClient.NetworkLateUpdate();
Profiler.EndSample();
} }
} }
} }

View File

@ -3,6 +3,7 @@
using System.Linq; using System.Linq;
using Mirror.RemoteCalls; using Mirror.RemoteCalls;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling;
namespace Mirror namespace Mirror
{ {
@ -1928,7 +1929,11 @@ static void BroadcastToConnection(NetworkConnectionToClient connection)
{ {
// get serialization for this entity viewed by this connection // get serialization for this entity viewed by this connection
// (if anything was serialized this time) // (if anything was serialized this time)
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("BroadcastToConnection: SerializeForConnection");
NetworkWriter serialization = SerializeForConnection(identity, connection); NetworkWriter serialization = SerializeForConnection(identity, connection);
Profiler.EndSample();
if (serialization != null) if (serialization != null)
{ {
EntityStateMessage message = new EntityStateMessage EntityStateMessage message = new EntityStateMessage
@ -1936,7 +1941,11 @@ static void BroadcastToConnection(NetworkConnectionToClient connection)
netId = identity.netId, netId = identity.netId,
payload = serialization.ToArraySegment() payload = serialization.ToArraySegment()
}; };
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("BroadcastToConnection: Send");
connection.Send(message); connection.Send(message);
Profiler.EndSample();
} }
} }
// spawned list should have no null entries because we // spawned list should have no null entries because we
@ -2017,7 +2026,10 @@ static void Broadcast()
} }
// update connection to flush out batched messages // update connection to flush out batched messages
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("Broadcast: Flush");
connection.Update(); connection.Update();
Profiler.EndSample();
} }
} }
@ -2034,12 +2046,19 @@ internal static void NetworkEarlyUpdate()
} }
// process all incoming messages first before updating the world // process all incoming messages first before updating the world
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkServer: Transport Processing");
if (Transport.active != null) if (Transport.active != null)
Transport.active.ServerEarlyUpdate(); Transport.active.ServerEarlyUpdate();
Profiler.EndSample();
// step each connection's local time interpolation in early update. // step each connection's local time interpolation in early update.
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkServer: Connections Time Update");
foreach (NetworkConnectionToClient connection in connections.Values) foreach (NetworkConnectionToClient connection in connections.Values)
connection.UpdateTimeInterpolation(); connection.UpdateTimeInterpolation();
Profiler.EndSample();
if (active) earlyUpdateDuration.End(); if (active) earlyUpdateDuration.End();
} }
@ -2068,13 +2087,21 @@ internal static void NetworkLateUpdate()
// Unity 2019 doesn't have Time.timeAsDouble yet // Unity 2019 doesn't have Time.timeAsDouble yet
bool sendIntervalElapsed = AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime); bool sendIntervalElapsed = AccurateInterval.Elapsed(NetworkTime.localTime, sendInterval, ref lastSendTime);
if (!Application.isPlaying || sendIntervalElapsed) if (!Application.isPlaying || sendIntervalElapsed)
{
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkServer: Broadcast");
Broadcast(); Broadcast();
Profiler.EndSample();
}
} }
// process all outgoing messages after updating the world // process all outgoing messages after updating the world
// (even if not active. still want to process disconnects etc.) // (even if not active. still want to process disconnects etc.)
// profiling marker for shallow profiling to show more than "UpdateFunction.Invoke
Profiler.BeginSample("NetworkServer: Transport Flush");
if (Transport.active != null) if (Transport.active != null)
Transport.active.ServerLateUpdate(); Transport.active.ServerLateUpdate();
Profiler.EndSample();
// measure actual tick rate every second. // measure actual tick rate every second.
if (active) if (active)

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -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;
} }
} }
} }