Class NetworkList<T>
Event based NetworkVariable container for syncing Lists
Inheritance
NetworkList<T>
Assembly: Unity.Netcode.Runtime.dll
Syntax
[GenerateSerializationForGenericParameter(0)]
public class NetworkList<T> : NetworkVariableBase, IDisposable where T : unmanaged, IEquatable<T>
Type Parameters
Name |
Description |
T |
The type for the list
|
Constructors
NetworkList()
Constructor method for NetworkList
Declaration
NetworkList(IEnumerable<T>, NetworkVariableReadPermission, NetworkVariableWritePermission)
Declaration
public NetworkList(IEnumerable<T> values = null, NetworkVariableReadPermission readPerm = NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission writePerm = NetworkVariableWritePermission.Server)
Parameters
Properties
Count
Declaration
public int Count { get; }
Property Value
this[int]
Declaration
public T this[int index] { get; set; }
Parameters
Type |
Name |
Description |
int |
index |
|
Property Value
LastModifiedTick
This is actually unused left-over from a previous interface
Declaration
public int LastModifiedTick { get; }
Property Value
Methods
Add(T)
Declaration
Parameters
Type |
Name |
Description |
T |
item |
|
Clear()
Declaration
Contains(T)
Declaration
public bool Contains(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Dispose()
Overridden IDisposable implementation.
CAUTION: If you derive from this class and override the Dispose() method,
you must always invoke the base.Dispose() method!
Declaration
public override void Dispose()
Overrides
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
IndexOf(T)
Declaration
public int IndexOf(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Insert(int, T)
Declaration
public void Insert(int index, T item)
Parameters
Type |
Name |
Description |
int |
index |
|
T |
item |
|
IsDirty()
Gets Whether or not the container is dirty
Declaration
public override bool IsDirty()
Returns
Type |
Description |
bool |
Whether or not the container is dirty
|
Overrides
ReadDelta(FastBufferReader, bool)
Reads delta from the reader and applies them to the internal value
Declaration
public override void ReadDelta(FastBufferReader reader, bool keepDirtyDelta)
Parameters
Type |
Name |
Description |
FastBufferReader |
reader |
The stream to read the delta from
|
bool |
keepDirtyDelta |
Whether or not the delta should be kept as dirty or consumed
|
Overrides
ReadField(FastBufferReader)
Reads the complete state from the reader and applies it
Declaration
public override void ReadField(FastBufferReader reader)
Parameters
Overrides
Remove(T)
Declaration
public bool Remove(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
RemoveAt(int)
Declaration
public void RemoveAt(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
ResetDirty()
Resets the dirty state and marks the variable as synced / clean
Declaration
public override void ResetDirty()
Overrides
WriteDelta(FastBufferWriter)
Writes the dirty changes, that is, the changes since the variable was last dirty, to the writer
Declaration
public override void WriteDelta(FastBufferWriter writer)
Parameters
Type |
Name |
Description |
FastBufferWriter |
writer |
The stream to write the dirty changes to
|
Overrides
WriteField(FastBufferWriter)
Writes the complete state of the variable to the writer
Declaration
public override void WriteField(FastBufferWriter writer)
Parameters
Overrides
Events
OnListChanged
The callback to be invoked when the list gets changed
Declaration
public event NetworkList<T>.OnListChangedDelegate OnListChanged
Event Type
Implements
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.