• API Documentation

    Show / Hide Table of Contents
    • UnofficialMultiplayerAPI
      • IMultiplayerInit
      • ISyncable
      • ISyncField
      • ISyncMethod
      • MPApi
      • SyncContext
      • SyncerAttribute
      • SyncMethodAttribute
      • SyncWorker
      • UninitializedAPI

    Interface ISyncField

    SyncField interface.

    Namespace: UnofficialMultiplayerAPI
    Assembly: 0UnofficialMultiplayerAPI.dll
    Syntax
    public interface ISyncField
    Examples

    Creates and registers a SyncField that points to myField in object of type MyType and enables its change buffer.

    MPApi.SyncField(typeof(MyType), "myField").SetBufferChanges();

    Creates and registers a SyncField that points to myField which resides in MyStaticClass.

    MPApi.SyncField(null, "MyAssemblyNamespace.MyStaticClass.myField");

    Creates and registers a SyncField that points to myField that resides in an object stored by myEnumberable defined in an object of type MyType.

    To watch this one you have to supply an index in Watch(Object, Object).

    MPApi.SyncField(typeof(MyType), "myEnumerable/[]/myField");

    Methods

    CancelIfValueNull()

    Instructs SyncField to cancel synchronization if the value of the member it's pointing at is null.

    Declaration
    ISyncField CancelIfValueNull()
    Returns
    Type Description
    ISyncField

    self

    InGameLoop()

    Instructs SyncField to sync in game loop.

    Declaration
    ISyncField InGameLoop()
    Returns
    Type Description
    ISyncField

    self

    PostApply(Action<Object, Object>)

    Adds an Action that runs after a field is synchronized.

    Declaration
    ISyncField PostApply(Action<object, object> action)
    Parameters
    Type Name Description
    Action<Object, Object> action

    An action ran after a field is synchronized. Called with target and value.

    Returns
    Type Description
    ISyncField

    self

    PreApply(Action<Object, Object>)

    Adds an Action that runs before a field is synchronized.

    Declaration
    ISyncField PreApply(Action<object, object> action)
    Parameters
    Type Name Description
    Action<Object, Object> action

    An action ran before a field is synchronized. Called with target and value.

    Returns
    Type Description
    ISyncField

    self

    SetBufferChanges()

    Instructs SyncField to use a buffer instead of syncing instantly (when FieldWatchPostfix() is called).

    Declaration
    ISyncField SetBufferChanges()
    Returns
    Type Description
    ISyncField

    self

    SetDebugOnly()

    Instructs SyncField to synchronize only in debug mode.

    Declaration
    ISyncField SetDebugOnly()
    Returns
    Type Description
    ISyncField

    self

    SetHostOnly()

    Instructs SyncField to synchronize only if it's invoked by the host.

    Declaration
    ISyncField SetHostOnly()
    Returns
    Type Description
    ISyncField

    self

    SetVersion(Int32)

    Declaration
    ISyncField SetVersion(int version)
    Parameters
    Type Name Description
    Int32 version
    Returns
    Type Description
    ISyncField

    self

    Watch(Object, Object)

    Declaration
    void Watch(object target = null, object index = null)
    Parameters
    Type Name Description
    Object target

    An object of type set in the ISyncField. Set to null if you're watching a static field.

    Object index

    Index in the field path set in ISyncField.

    Back to top Generated by DocFX