mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
feat(NetworkTransform): Default Sync Direction = Client To Server (#3741)
* feat(NetworkTransform): Default Sync Direction = Client To Server - This is done in Reset so Network Behaviour isn't effected. - This will not change NT components already in place on objects / prefabs unless user manually chooses Reset in the inspector. * Update Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs --------- Co-authored-by: mischa <16416509+miwarnec@users.noreply.github.com>
This commit is contained in:
parent
e10ab75bf5
commit
258a84c066
@ -378,6 +378,8 @@ public virtual void ResetState()
|
|||||||
public virtual void Reset()
|
public virtual void Reset()
|
||||||
{
|
{
|
||||||
ResetState();
|
ResetState();
|
||||||
|
// default to ClientToServer so this works immediately for users
|
||||||
|
syncDirection = SyncDirection.ClientToServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnEnable()
|
protected virtual void OnEnable()
|
||||||
|
@ -314,6 +314,9 @@ public void OnServerToClientSync_WithClientAuthority_Nullables_Uses_Last()
|
|||||||
component.netIdentity.isClient = true;
|
component.netIdentity.isClient = true;
|
||||||
component.netIdentity.isLocalPlayer = true;
|
component.netIdentity.isLocalPlayer = true;
|
||||||
|
|
||||||
|
// client authority has to be disabled
|
||||||
|
component.syncDirection = SyncDirection.ServerToClient;
|
||||||
|
|
||||||
// call OnClientToServerSync with authority and nullable types
|
// call OnClientToServerSync with authority and nullable types
|
||||||
// to make sure it uses the last valid position then.
|
// to make sure it uses the last valid position then.
|
||||||
component.OnServerToClientSync(new Vector3?(), new Quaternion?(), new Vector3?());
|
component.OnServerToClientSync(new Vector3?(), new Quaternion?(), new Vector3?());
|
||||||
|
Loading…
Reference in New Issue
Block a user