feat(NetworkRigidbody): Default Sync Direction = Client To Server (#3764)

- This is done in Reset so Network Behaviour isn't effected.
- This will not change components already in place on objects / prefabs unless user manually chooses Reset in the inspector.
This commit is contained in:
MrGadget 2024-02-09 03:47:23 -05:00
parent 0821e56105
commit 136c1d2b30
3 changed files with 21 additions and 0 deletions

View File

@ -38,8 +38,15 @@ public class NetworkLerpRigidbody : NetworkBehaviour
protected override void OnValidate()
{
base.OnValidate();
Reset();
}
public virtual void Reset()
{
if (target == null)
target = GetComponent<Rigidbody>();
syncDirection = SyncDirection.ClientToServer;
}
void Update()

View File

@ -42,8 +42,15 @@ public class NetworkRigidbody : NetworkBehaviour
protected override void OnValidate()
{
base.OnValidate();
Reset();
}
public virtual void Reset()
{
if (target == null)
target = GetComponent<Rigidbody>();
syncDirection = SyncDirection.ClientToServer;
}
#region Sync vars

View File

@ -40,8 +40,15 @@ public class NetworkRigidbody2D : NetworkBehaviour
protected override void OnValidate()
{
base.OnValidate();
Reset();
}
public virtual void Reset()
{
if (target == null)
target = GetComponent<Rigidbody2D>();
syncDirection = SyncDirection.ClientToServer;
}
#region Sync vars