Skip to content

Commit b692313

Browse files
harayuu9EmandM
authored andcommitted
comment with see cref
1 parent 7d04852 commit b692313

File tree

1 file changed

+11
-3
lines changed
  • com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,20 @@ public T this[int index]
632632
}
633633

634634
/// <summary>
635-
/// Returns the contents of the NetworkList as a read-only NativeArray.
635+
/// Gets a **zero‑allocation**, read‑only
636+
/// <see cref="Unity.Collections.NativeArray{T}.ReadOnly"/> view over the current
637+
/// elements of this <see cref="NetworkList{T}"/>.
636638
/// </summary>
637639
/// <remarks>
638-
/// This method returns the list contents as a NativeArray.ReadOnly. Be careful with the lifetime of the NativeArray.
640+
/// The returned array stays valid **only until** the list is mutated (add, remove,
641+
/// clear, resize) or the container is <see cref="Dispose()"/>d. Continuing to use
642+
/// it afterwards results in undefined behaviour; callers are responsible for
643+
/// ensuring a safe lifetime.
639644
/// </remarks>
640-
/// <returns>A read-only NativeArray of the list contents.</returns>
645+
/// <returns>
646+
/// A read‑only <see cref="Unity.Collections.NativeArray{T}.ReadOnly"/> that shares
647+
/// the same backing memory as this list.
648+
/// </returns>
641649
public NativeArray<T>.ReadOnly AsNativeArray()
642650
{
643651
return m_List.AsReadOnly();

0 commit comments

Comments
 (0)