Skip to content

Commit 108177f

Browse files
committed
Made Command, Rpc and Targets invoke on caller if is host
1 parent a2ca5ea commit 108177f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ protected void InvokeCommand(string methodName, params object[] methodParams)
282282
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("Calling InvokeCommand is not allowed when AttributeMessageMode is set to disabled");
283283
return;
284284
}
285+
if (isHost) cachedMethods[methodName].Invoke(this, methodParams);
285286

286287
ulong hash = Data.Cache.GetMessageAttributeHash(methodName, NetworkingManager.singleton.NetworkConfig.AttributeMessageMode);
287288
using (BitWriter writer = BitWriter.Get())
@@ -318,6 +319,7 @@ protected void InvokeClientRpc(string methodName, params object[] methodParams)
318319
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("Calling InvokeClientRpc is not allowed when AttributeMessageMode is set to disabled");
319320
return;
320321
}
322+
if (isHost) cachedMethods[methodName].Invoke(this, methodParams);
321323

322324
ulong hash = Data.Cache.GetMessageAttributeHash(methodName, NetworkingManager.singleton.NetworkConfig.AttributeMessageMode);
323325
using (BitWriter writer = BitWriter.Get())
@@ -354,6 +356,7 @@ protected void InvokeTargetRpc(string methodName, params object[] methodParams)
354356
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("Calling InvokeTargetRpc is not allowed when AttributeMessageMode is set to disabled");
355357
return;
356358
}
359+
if (isHost) cachedMethods[methodName].Invoke(this, methodParams);
357360

358361
ulong hash = Data.Cache.GetMessageAttributeHash(methodName, NetworkingManager.singleton.NetworkConfig.AttributeMessageMode);
359362
using (BitWriter writer = BitWriter.Get())

0 commit comments

Comments
 (0)