Skip to content

Commit

Permalink
fix: updating code and example for mirror v81.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Dec 1, 2023
1 parent 8a4877d commit c03b889
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Assets/Example/ExamplePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Mirage.NetworkProfiler.Example
{
[RequireComponent(typeof(NetworkIdentity))]
[RequireComponent(typeof(NetworkTransform))]
[RequireComponent(typeof(NetworkTransformUnreliable))]
public class ExamplePlayer : NetworkBehaviour
{
[SerializeField] private float _moveSpeed = 10;
Expand Down
23 changes: 12 additions & 11 deletions Assets/Example/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
sceneId: 0
_assetId: 2973684376
serverOnly: 0
visible: 0
m_AssetId: 56008f2ead63c5b449565c779ca6d655
hasSpawned: 0
--- !u!114 &2323629024606040365
MonoBehaviour:
Expand All @@ -61,31 +61,31 @@ MonoBehaviour:
m_GameObject: {fileID: 722945615397717584}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f74aedd71d9a4f55b3ce499326d45fb, type: 3}
m_Script: {fileID: 11500000, guid: a553cb17010b2403e8523b558bffbc14, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0.1
syncInterval: 0
target: {fileID: 8833559844984716782}
clientAuthority: 0
sendInterval: 0.05
syncPosition: 1
syncRotation: 1
syncScale: 0
interpolatePosition: 1
interpolateRotation: 1
interpolateScale: 0
bufferTimeMultiplier: 1
bufferSizeLimit: 64
catchupThreshold: 4
catchupMultiplier: 0.1
coordinateSpace: 0
sendIntervalMultiplier: 1
timelineOffset: 0
showGizmos: 0
showOverlay: 0
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
onlySyncOnChange: 1
bufferResetMultiplier: 5
positionSensitivity: 0.01
rotationSensitivity: 0.01
scaleSensitivity: 0.01
showGizmos: 0
showOverlay: 0
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
--- !u!114 &3245701489431678148
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -98,6 +98,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 0b65055561345344a819a75fc3f18135, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0.1
_moveSpeed: 10
Expand Down
13 changes: 10 additions & 3 deletions Assets/Mirage.Profiler/Runtime/NetworkInfoProvider.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// mirror removes defines (for some reason) so need to check if any of the defines exist
// if they any do it is new version so set MIRROR_RPC_USHORT so the code below can use it
#if MIRROR_2022_9_OR_NEWER || MIRROR_70_OR_NEWER || MIRROR_85_OR_NEWER
#define MIRROR_RPC_USHORT
#endif


using System.Text.RegularExpressions;
using Mirror;
using Mirror.RemoteCalls;
Expand Down Expand Up @@ -65,10 +72,10 @@ public string GetRpcName(NetworkDiagnostics.MessageInfo info)
}
}

#if !MIRROR_2022_9_OR_NEWER
private string GetRpcName(uint netId, int componentIndex, int functionIndex)
#else
#if MIRROR_RPC_USHORT
private string GetRpcName(uint netId, int componentIndex, ushort functionIndex)
#else
private string GetRpcName(uint netId, int componentIndex, int functionIndex)
#endif
{
var hash = functionIndex;
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ PlayerSettings:
webGLDecompressionFallback: 0
webGLPowerPreference: 2
scriptingDefineSymbols:
Standalone: MIRROR;MIRROR_17_0_OR_NEWER;MIRROR_18_0_OR_NEWER;MIRROR_24_0_OR_NEWER;MIRROR_26_0_OR_NEWER;MIRROR_27_0_OR_NEWER;MIRROR_28_0_OR_NEWER;MIRROR_29_0_OR_NEWER;MIRROR_30_0_OR_NEWER;MIRROR_30_5_2_OR_NEWER;MIRROR_32_1_2_OR_NEWER;MIRROR_32_1_4_OR_NEWER;MIRROR_35_0_OR_NEWER;MIRROR_35_1_OR_NEWER;MIRROR_37_0_OR_NEWER;MIRROR_38_0_OR_NEWER;MIRROR_39_0_OR_NEWER;MIRROR_40_0_OR_NEWER;MIRROR_41_0_OR_NEWER;MIRROR_42_0_OR_NEWER;MIRROR_43_0_OR_NEWER;MIRROR_44_0_OR_NEWER;MIRROR_46_0_OR_NEWER;MIRROR_47_0_OR_NEWER;MIRROR_53_0_OR_NEWER;MIRROR_55_0_OR_NEWER;MIRROR_57_0_OR_NEWER;MIRROR_58_0_OR_NEWER;MIRROR_65_0_OR_NEWER;MIRROR_66_0_OR_NEWER;MIRROR_2022_9_OR_NEWER;MIRROR_2022_10_OR_NEWER;MIRROR_70_0_OR_NEWER;MIRROR_71_0_OR_NEWER;MIRROR_73_OR_NEWER;MIRROR_78_OR_NEWER;MIRROR_79_OR_NEWER
Standalone: MIRROR_70_OR_NEWER;MIRROR;MIRROR_57_0_OR_NEWER;MIRROR_58_0_OR_NEWER;MIRROR_65_0_OR_NEWER;MIRROR_66_0_OR_NEWER;MIRROR_2022_9_OR_NEWER;MIRROR_2022_10_OR_NEWER;MIRROR_70_0_OR_NEWER;MIRROR_71_0_OR_NEWER;MIRROR_73_OR_NEWER;MIRROR_78_OR_NEWER;MIRROR_79_OR_NEWER
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend: {}
Expand Down

0 comments on commit c03b889

Please sign in to comment.