Skip to content

Commit cab4d78

Browse files
michalChrobotNoelStephensUnityEmandM
authored
docs: [2.X] fixes of PVP exceptions (#3225)
This PR focuses on fixing PVP errors related to PVP-151-1 "**_Public APIs should be documented_**" and all remaining PVP errors **present in pvpExceptions.json file** We currently have 768 errors to address so this PR will be a collaborative effort. If anyone want's to add to it what we should do is: 1. Check errors present in pvpExceptions.json file (preferably under "PVP-150-1", choose some to fix 2. Address those errors and when making commit remove the fixed errors from pvpExceptions file In general [new CI implementation](#3193) will catch all new errors like this so all we need to do is fix the present ones. This PR **does not** focus on PVP present in gold profile but if capacity allows, those can also be addressed. **Error present in "PVP-41-1" is to be expected** so there is no need of fixing this one! --------- Co-authored-by: Noel Stephens <[email protected]> Co-authored-by: Emma <[email protected]>
1 parent d79c743 commit cab4d78

File tree

3 files changed

+88
-25
lines changed

3 files changed

+88
-25
lines changed

com.unity.netcode.gameobjects/Runtime/Components/AnticipatedNetworkTransform.cs

+14
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,24 @@ public class AnticipatedNetworkTransform : NetworkTransform
5050
internal override bool HideInterpolateValue => true;
5151
#endif
5252

53+
/// <summary>
54+
/// Represents a complete transform state for network synchronization and anticipation
55+
/// </summary>
5356
public struct TransformState
5457
{
58+
/// <summary>
59+
/// The position component of the transform state in world space coordinates.
60+
/// </summary>
5561
public Vector3 Position;
62+
63+
/// <summary>
64+
/// The rotation component of the transform state as a quaternion.
65+
/// </summary>
5666
public Quaternion Rotation;
67+
68+
/// <summary>
69+
/// The scale component of the transform state in local space.
70+
/// </summary>
5771
public Vector3 Scale;
5872
}
5973

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/BaseRpcTarget.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ internal BaseRpcTarget(NetworkManager manager)
2929
}
3030

3131
/// <summary>
32-
/// Can be used to provide additional lock checks before disposing the target.
32+
/// Verifies the target can be disposed based on its lock state.
3333
/// </summary>
34-
/// <exception cref="Exception">The exception thrown if the target is still locked when disposed.</exception>
34+
/// <exception cref="Exception">Thrown when attempting to dispose a locked temporary RPC target</exception>
3535
protected void CheckLockBeforeDispose()
3636
{
3737
if (m_Locked)
@@ -41,7 +41,7 @@ protected void CheckLockBeforeDispose()
4141
}
4242

4343
/// <summary>
44-
/// Invoked when the target is disposed.
44+
/// Releases resources used by the RPC target.
4545
/// </summary>
4646
public abstract void Dispose();
4747

com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs

+71-22
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public class NetworkList<T> : NetworkVariableBase where T : unmanaged, IEquatabl
2121
public delegate void OnListChangedDelegate(NetworkListEvent<T> changeEvent);
2222

2323
/// <summary>
24-
/// The callback to be invoked when the list gets changed
24+
/// Creates A NetworkList/>
2525
/// </summary>
2626
public event OnListChangedDelegate OnListChanged;
2727

2828
/// <summary>
29-
/// Constructor method for <see cref="NetworkList"/>
29+
/// Constructor method for <see cref="NetworkList{T}"/>
3030
/// </summary>
3131
public NetworkList() { }
3232

@@ -132,7 +132,7 @@ public override void WriteDelta(FastBufferWriter writer)
132132
}
133133
}
134134

135-
/// <inheritdoc cref="NetworkVariable{T}.Writeield"/>
135+
/// <inheritdoc cref="NetworkVariable{T}.WriteField"/>
136136
public override void WriteField(FastBufferWriter writer)
137137
{
138138
writer.WriteValueSafe((ushort)m_List.Length);
@@ -158,12 +158,12 @@ public override void ReadField(FastBufferReader reader)
158158
/// <inheritdoc cref="NetworkVariable{T}.ReadDelta"/>
159159
public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta)
160160
{
161-
/// This is only invoked by <see cref="NetworkVariableDeltaMessage"/> and the only time
162-
/// keepDirtyDelta is set is when it is the server processing. To be able to handle previous
163-
/// versions, we use IsServer to keep the dirty states received and the keepDirtyDelta to
164-
/// actually mark this as dirty and add it to the list of <see cref="NetworkObject"/>s to
165-
/// be updated. With the forwarding of deltas being handled by <see cref="NetworkVariableDeltaMessage"/>,
166-
/// once all clients have been forwarded the dirty events, we clear them by invoking <see cref="PostDeltaRead"/>.
161+
// This is only invoked by <see cref="NetworkVariableDeltaMessage"/> and the only time
162+
// keepDirtyDelta is set is when it is the server processing. To be able to handle previous
163+
// versions, we use IsServer to keep the dirty states received and the keepDirtyDelta to
164+
// actually mark this as dirty and add it to the list of <see cref="NetworkObject"/>s to
165+
// be updated. With the forwarding of deltas being handled by <see cref="NetworkVariableDeltaMessage"/>,
166+
// once all clients have been forwarded the dirty events, we clear them by invoking <see cref="PostDeltaRead"/>.
167167
var isServer = m_NetworkManager.IsServer;
168168
reader.ReadValueSafe(out ushort deltaCount);
169169
for (int i = 0; i < deltaCount; i++)
@@ -406,13 +406,22 @@ internal override void PostDeltaRead()
406406
}
407407
}
408408

409-
/// <inheritdoc cref="NetworkVariable{T}.GetEnumerator"/>
409+
/// <summary>
410+
/// Returns an enumerator that iterates through the <see cref="NetworkList{T}" />.
411+
/// </summary>
412+
/// <returns>An enumerator for the <see cref="NetworkList{T}"/>.</returns>
410413
public IEnumerator<T> GetEnumerator()
411414
{
412415
return m_List.GetEnumerator();
413416
}
414417

415-
/// <inheritdoc cref="NetworkVariable{T}.Add"/>
418+
/// <summary>
419+
/// Adds an item to the end of the <see cref="NetworkList{T}"/>.
420+
/// </summary>
421+
/// <param name="item">The item to be added to the list.</param>
422+
/// <remarks>
423+
/// This method checks for write permissions before adding the item.
424+
/// </remarks>
416425
public void Add(T item)
417426
{
418427
// check write permissions
@@ -434,7 +443,12 @@ public void Add(T item)
434443
HandleAddListEvent(listEvent);
435444
}
436445

437-
/// <inheritdoc cref="NetworkVariable{T}.Clear"/>
446+
/// <summary>
447+
/// Removes all items from the <see cref="NetworkList{T}"/>.
448+
/// </summary>
449+
/// <remarks>
450+
/// This method checks for write permissions before clearing the list.
451+
/// </remarks>
438452
public void Clear()
439453
{
440454
// check write permissions
@@ -454,14 +468,25 @@ public void Clear()
454468
HandleAddListEvent(listEvent);
455469
}
456470

457-
/// <inheritdoc cref="NetworkVariable{T}.Contains"/>
471+
/// <summary>
472+
/// Determines whether the <see cref="NetworkList{T}"/> contains a specific value.
473+
/// </summary>
474+
/// <param name="item">The object to locate in the <see cref="NetworkList{T}"/>.</param>
475+
/// <returns><see langword="true" /> if the <see cref="item"/> is found in the <see cref="NetworkList{T}"/>; otherwise, <see langword="false" />.</returns>
458476
public bool Contains(T item)
459477
{
460478
int index = m_List.IndexOf(item);
461479
return index != -1;
462480
}
463481

464-
/// <inheritdoc cref="NetworkVariable{T}.Remove"/>
482+
/// <summary>
483+
/// Removes the first occurrence of a specific object from the NetworkList.
484+
/// </summary>
485+
/// <remarks>
486+
/// This method checks for write permissions before removing the item.
487+
/// </remarks>
488+
/// <param name="item">The object to remove from the list.</param>
489+
/// <returns><see langword="true" /> if the item was successfully removed from the list; otherwise, <see langword="false" />.</returns>
465490
public bool Remove(T item)
466491
{
467492
// check write permissions
@@ -488,16 +513,29 @@ public bool Remove(T item)
488513
return true;
489514
}
490515

491-
/// <inheritdoc cref="NetworkVariable{T}.Count"/>
516+
/// <summary>
517+
/// Gets the number of elements contained in the <see cref="NetworkList{T}"/>.
518+
/// </summary>
492519
public int Count => m_List.Length;
493520

494-
/// <inheritdoc cref="NetworkVariable{T}.IndexOf"/>
521+
/// <summary>
522+
/// Determines the index of a specific <see cref="item"/> in the <see cref="NetworkList{T}"/>.
523+
/// </summary>
524+
/// <param name="item">The object to remove from the list.</param>
525+
/// <returns>The index of the <see cref="item"/> if found in the list; otherwise, -1.</returns>
495526
public int IndexOf(T item)
496527
{
497528
return m_List.IndexOf(item);
498529
}
499530

500-
/// <inheritdoc cref="NetworkVariable{T}.Insert"/>
531+
/// <summary>
532+
/// Inserts <see cref="item"/> to the <see cref="NetworkList{T}"/> at the specified <see cref="index"/>.
533+
/// </summary>
534+
/// <remarks>
535+
/// This method checks for write permissions before inserting the item.
536+
/// </remarks>
537+
/// <param name="index">The index at which the item should be inserted.</param>
538+
/// <param name="item">The item to insert.</param>
501539
public void Insert(int index, T item)
502540
{
503541
// check write permissions
@@ -527,7 +565,13 @@ public void Insert(int index, T item)
527565
HandleAddListEvent(listEvent);
528566
}
529567

530-
/// <inheritdoc cref="NetworkVariable{T}.RemoveAt"/>
568+
/// <summary>
569+
/// Removes the <see cref="NetworkList{T}"/> item at the specified <see cref="index"/>.
570+
/// </summary>
571+
/// <remarks>
572+
/// This method checks for write permissions before removing the item.
573+
/// </remarks>
574+
/// <param name="index">The index of the element to remove.</param>
531575
public void RemoveAt(int index)
532576
{
533577
// check write permissions
@@ -549,9 +593,14 @@ public void RemoveAt(int index)
549593
HandleAddListEvent(listEvent);
550594
}
551595

552-
553-
554-
/// <inheritdoc cref="NetworkVariable{T}.this"/>
596+
/// <summary>
597+
/// Gets or sets the element at the specified index in the <see cref="NetworkList{T}"/>.
598+
/// </summary>
599+
/// <remarks>
600+
/// This method checks for write permissions before setting the value.
601+
/// </remarks>
602+
/// <param name="index">The zero-based index of the element to get or set.</param>
603+
/// <value>The element at the specified index.</value>
555604
public T this[int index]
556605
{
557606
get => m_List[index];
@@ -587,7 +636,7 @@ private void HandleAddListEvent(NetworkListEvent<T> listEvent)
587636
}
588637

589638
/// <summary>
590-
/// This is actually unused left-over from a previous interface
639+
/// This method should not be used. It is left over from a previous interface
591640
/// </summary>
592641
public int LastModifiedTick
593642
{

0 commit comments

Comments
 (0)