Skip to content

Commit

Permalink
adding doc
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelBellomo committed Sep 16, 2021
1 parent 3add037 commit 353c12c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions com.unity.netcode.gameobjects/Components/NetworkTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ public void NetworkSerialize(NetworkSerializer serializer)
private Transform m_Transform; // cache the transform component to reduce unnecessary bounce between managed and native
private int m_LastSentTick;

/// <summary>
/// Tries updating the server authoritative transform, only if allowed.
/// If this called server side, this will commit directly.
/// If no update is needed, nothing will be sent. This method should still be called every update, it'll self manage when it should and shouldn't send
/// </summary>
/// <param name="transformToCommit"></param>
/// <param name="dirtyTime"></param>
protected void TryCommitTransformToServer(Transform transformToCommit, double dirtyTime)
{
var isDirty = ApplyTransformToNetworkState(ref m_LocalAuthoritativeNetworkState, dirtyTime, transformToCommit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ namespace Unity.Netcode.Samples
/// </summary>
public class ClientNetworkTransform : NetworkTransform
{
/// <summary>
/// Used to determine who can write to this transform. Owner client only
/// Changing this value alone will not allow you to create a NetworkTransform which can be written to by clients.
/// We're using RPCs to send updated values from client to server. Netcode doesn't support client side network variable writing
/// </summary>
protected override bool CanWriteToTransform => IsClient && IsOwner;

protected override void Update()
Expand Down

0 comments on commit 353c12c

Please sign in to comment.