Table of Contents

Class SyncVar<T>

Namespace
AO
Assembly
CoreAssembly.dll

SyncVar allows you to keep variables in sync from the server to all clients.

public class SyncVar<T> : SyncVarBase

Type Parameters

T

Supported types: int, float, bool, string, Vector2, Vector3, Vector4, Entity

Inheritance
SyncVar<T>
Inherited Members
Extension Methods

Constructors

SyncVar()

public SyncVar()

SyncVar(T)

public SyncVar(T value)

Parameters

value T

Properties

Value

public T Value { get; }

Property Value

T

Methods

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

OnSyncGeneric_Internal(T)

public void OnSyncGeneric_Internal(T newValue)

Parameters

newValue T

OnSync_Internal(StreamReader)

public override void OnSync_Internal(StreamReader reader)

Parameters

reader StreamReader

OnSync_Internal(byte[])

public override void OnSync_Internal(byte[] data)

Parameters

data byte[]

Set(T)

public void Set(T value)

Parameters

value T

Set(T, bool)

Set the value of the SyncVar. This should only be called on the server.

public void Set(T value, bool forceSync = false)

Parameters

value T

Value to set the SyncVar to

forceSync bool

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

WriteToStreamWriter(StreamWriter)

public override void WriteToStreamWriter(StreamWriter writer)

Parameters

writer StreamWriter

Events

OnSync

public event Action<T, T> OnSync

Event Type

Action<T, T>

Operators

operator ==(SyncVar<T>, SyncVar<T>)

public static bool operator ==(SyncVar<T> a, SyncVar<T> b)

Parameters

a SyncVar<T>
b SyncVar<T>

Returns

bool

operator ==(SyncVar<T>, T)

public static bool operator ==(SyncVar<T> a, T b)

Parameters

a SyncVar<T>
b T

Returns

bool

operator ==(T, SyncVar<T>)

public static bool operator ==(T a, SyncVar<T> b)

Parameters

a T
b SyncVar<T>

Returns

bool

implicit operator T(SyncVar<T>)

public static implicit operator T(SyncVar<T> syncVar)

Parameters

syncVar SyncVar<T>

Returns

T

operator !=(SyncVar<T>, SyncVar<T>)

public static bool operator !=(SyncVar<T> a, SyncVar<T> b)

Parameters

a SyncVar<T>
b SyncVar<T>

Returns

bool

operator !=(SyncVar<T>, T)

public static bool operator !=(SyncVar<T> a, T b)

Parameters

a SyncVar<T>
b T

Returns

bool

operator !=(T, SyncVar<T>)

public static bool operator !=(T a, SyncVar<T> b)

Parameters

a T
b SyncVar<T>

Returns

bool