• Api Documentation
  • Manual
Show / Hide Table of Contents
  • FishNet
    • InstanceFinder
  • FishNet.Authenticating
    • Authenticator
  • FishNet.Broadcast
    • IBroadcast
  • FishNet.Broadcast.Helping
    • BroadcastHandlerBase
  • FishNet.CodeGenerating
    • AllowMutableSyncTypeAttribute
    • CustomComparerAttribute
    • DefaultDeltaReaderAttribute
    • DefaultDeltaWriterAttribute
    • DefaultReaderAttribute
    • DefaultWriterAttribute
    • ExcludeSerializationAttribute
    • IncludeSerializationAttribute
    • NotSerializerAttribute
    • ReadUnallocatedAttribute
    • UseGlobalCustomSerializerAttribute
  • FishNet.Component.Animating
    • NetworkAnimator
  • FishNet.Component.ColliderRollback
    • ColliderRollback
    • RollbackManager
    • RollbackPhysicsType
  • FishNet.Component.Observing
    • DistanceCondition
    • GridCondition
    • GridEntry
    • HashGrid
    • HashGrid.GridAxes
    • HostOnlyCondition
    • MatchCondition
    • MatchCondition.ConditionCollections
    • OwnerOnlyCondition
    • SceneCondition
  • FishNet.Component.Ownership
    • PredictedOwner
    • PredictedSpawn
  • FishNet.Component.Prediction
    • NetworkCollider
    • NetworkCollider2D
    • NetworkCollision
    • NetworkCollision2D
    • NetworkTrigger
    • NetworkTrigger2D
    • OfflineRigidbody
    • Rigidbody2DState
    • RigidbodyPauser
    • RigidbodyState
    • RigidbodyStateExtensions
    • RigidbodyStateSerializers
    • RigidbodyType
  • FishNet.Component.Scenes
    • DefaultScene
  • FishNet.Component.Spawning
    • PlayerSpawner
  • FishNet.Component.Transforming
    • DetachableNetworkTickSmoother
    • MonoTickSmoother
    • NetworkTickSmoother
    • NetworkTransform
    • NetworkTransform.ComponentConfigurationType
    • NetworkTransform.GoalData
    • NetworkTransform.RateData
    • NetworkTransform.SnappedAxes
    • NetworkTransform.TransformData
    • NetworkTransform.TransformData.ExtrapolateState
    • SynchronizedProperty
  • FishNet.Component.Utility
    • BandwidthDisplay
    • PingDisplay
  • FishNet.Connection
    • NetworkConnection
    • NetworkConnectionExtensions
  • FishNet.Managing
    • NetworkManager
    • NetworkManager.HostIterationOrder
    • NetworkManager.PersistenceType
    • NetworkManagerExtensions
    • RemoteTimeoutType
  • FishNet.Managing.Client
    • ClientManager
    • ClientObjects
  • FishNet.Managing.Debugging
    • DebugManager
  • FishNet.Managing.Logging
    • LevelLoggingConfiguration
    • LoggingConfiguration
    • LoggingType
  • FishNet.Managing.Object
    • DualPrefab
    • ManagedObjects
  • FishNet.Managing.Observing
    • ObserverManager
  • FishNet.Managing.Predicting
    • PredictionManager
    • PredictionManager.PostPhysicsSyncTransformDel
    • PredictionManager.PostReconcileDel
    • PredictionManager.PostReplicateReplayDel
    • PredictionManager.PrePhysicsSyncTransformDel
    • PredictionManager.PreReconcileDel
    • PredictionManager.PreReplicateReplayDel
    • PredictionManager.ReconcileDel
    • PredictionManager.ReplicateReplayDel
    • ReplicateStateOrder
  • FishNet.Managing.Scened
    • ClientPresenceChangeEventArgs
    • DefaultSceneProcessor
    • EmptyStartScenesBroadcast
    • LoadOptions
    • LoadParams
    • LoadQueueData
    • PreferredScene
    • ReplaceOption
    • SceneLoadData
    • SceneLoadEndEventArgs
    • SceneLoadPercentEventArgs
    • SceneLoadStartEventArgs
    • SceneLookupData
    • SceneManager
    • SceneProcessorBase
    • SceneScopeType
    • SceneUnloadData
    • SceneUnloadEndEventArgs
    • SceneUnloadStartEventArgs
    • UnloadedScene
    • UnloadOptions
    • UnloadOptions.ServerUnloadMode
    • UnloadParams
    • UnloadQueueData
  • FishNet.Managing.Server
    • ClientConnectionChangeBroadcast
    • ConnectedClientsBroadcast
    • KickReason
    • ServerManager
    • ServerObjects
  • FishNet.Managing.Statistic
    • NetworkTrafficArgs
    • NetworkTraficStatistics
    • StatisticsManager
  • FishNet.Managing.Timing
    • EstimatedTick
    • EstimatedTick.OldTickOption
    • PhysicsMode
    • PreciseTick
    • PreciseTickExtensions
    • PreciseTickSerializer
    • TickRounding
    • TickType
    • TimeManager
  • FishNet.Managing.Transporting
    • IntermediateLayer
    • LatencySimulator
    • TransportManager
  • FishNet.Managing.Utility
    • Packets
  • FishNet.Object
    • ClientAttribute
    • DataOrderType
    • DespawnType
    • EmptyNetworkBehaviour
    • GlobalPreserveOwnedObjects
    • NetworkBehaviour
    • NetworkObject
    • NetworkObject.HostVisibilityUpdatedDelegate
    • NetworkObjectIdComparer
    • NetworkPreserveOwnedObjects
    • ObserversRpcAttribute
    • ReplicateState
    • ReplicateStateExtensions
    • RpcAttribute
    • ServerAttribute
    • ServerRpcAttribute
    • TargetRpcAttribute
    • TransformProperties
    • TransformPropertiesCls
    • TransformPropertiesFlag
    • TransformPropertiesOptionExtensions
  • FishNet.Object.Prediction
    • AdaptiveInterpolationType
    • ChildTransformTickSmoother
    • IReconcileData
    • IReplicateData
    • PredictionigidbodySerializers
    • PredictionRigidbody
    • PredictionRigidbody.AllForceData
    • PredictionRigidbody.EntryData
    • PredictionRigidbody.ForceApplicationType
    • PredictionRigidbody.IForceData
    • PredictionRigidbody2D
    • PredictionRigidbody2D.AllForceData
    • PredictionRigidbody2D.EntryData
    • PredictionRigidbody2D.ForceApplicationType
    • PredictionRigidbody2D2DSerializers
    • ReconcileAttribute
    • ReplicateAttribute
  • FishNet.Object.Synchronizing
    • ByteSyncVar
    • DoubleSyncVar
    • FloatSyncVar
    • ICustomSync
    • IntSyncVar
    • LongSyncVar
    • ReadPermission
    • SbyteSyncVar
    • ShortSyncVar
    • SyncDictionary<TKey, TValue>
    • SyncHashSet<T>
    • SyncList<T>
    • SyncObjectAttribute
    • SyncStopwatch
    • SyncStopwatch.SyncTypeChanged
    • SyncStopwatchOperation
    • SyncTimer
    • SyncTimer.SyncTypeChanged
    • SyncTimerOperation
    • SyncTypeSettings
    • SyncVarAttribute
    • UIntSyncVar
    • ULongSyncVar
    • UShortSyncVar
    • Vector2IntSyncVar
    • Vector2SyncVar
    • Vector3IntSyncVar
    • Vector3SyncVar
    • Vector4SyncVar
    • WritePermission
  • FishNet.Observing
    • HostVisibilityUpdateTypes
    • NetworkObserver
    • NetworkObserver.ConditionOverrideType
    • ObserverCondition
    • ObserverConditionType
  • FishNet.Serializing
    • AutoPackType
    • DeltaSerializerOption
    • DeltaSerializerOptionExtensions
    • PooledReader
    • PooledWriter
    • Reader
    • Reader.DataSource
    • ReaderPool
    • SubStream
    • Writer
    • WriterPool
  • FishNet.Transporting
    • Channel
    • ClientConnectionStateArgs
    • ClientReceivedDataArgs
    • ConnectedClientsArgs
    • IPAddressType
    • LocalConnectionState
    • RemoteConnectionState
    • RemoteConnectionStateArgs
    • ServerConnectionStateArgs
    • ServerReceivedDataArgs
    • Transport
    • TransportConsts
  • GameKit.Dependencies.Utilities
    • ApplicationState
    • Arrays
    • BasicQueue<T>
    • Booleans
    • Bytes
    • CanvaseGroups
    • CanvasGroupBlockingType
    • CollectionCaches<T>
    • CollectionCaches<T1, T2>
    • Collider2DExtensions
    • ColliderExtensions
    • DictionaryFN
    • Disks
    • Enums
    • Floats
    • Hashing
    • Ints
    • IOs
    • IResettable
    • IWeighted
    • Layers
    • LayoutGroups
    • Materials
    • Maths
    • ObjectCaches<T>
    • Objects
    • Particles
    • PointerMonoBehaviour
    • Quaternions
    • ResettableCollectionCaches<T>
    • ResettableCollectionCaches<T1, T2>
    • ResettableObjectCaches<T>
    • ResettableT1CollectionCaches<T1, T2>
    • ResettableT2CollectionCaches<T1, T2>
    • Strings
    • Transforms
    • UInts
    • Vectors
    • WeightedRandom
  • GameKit.Dependencies.Utilities.ObjectPooling
    • ListStack<GameObject>
    • ObjectPool
    • PoolData
  • GameKit.Dependencies.Utilities.ObjectPooling.Examples
    • Projectile
    • ProjectileSpawner
  • GameKit.Dependencies.Utilities.Types
    • ByteRange
    • CanvasGroupFader
    • CanvasGroupFader.FadeGoalType
    • CanvasTracker
    • DDOL
    • FloatRange
    • FloatRange2D
    • IntRange
    • IOrderable
    • RectTransformResizer
    • RectTransformResizer.ResizeData
    • RectTransformResizer.ResizeDelegate
    • ResettableRingBuffer<T>
    • ResettableRingBuffer<T>.Enumerator
    • RingBuffer<T>
    • RingBuffer<T>.Enumerator
    • SceneAttribute
    • ScrollbarValueSetter
    • SingletonScriptableObject<T>
    • SmoothCameraTarget
    • TimedOperation
    • UIntRange
    • Vector2Range
  • GameKit.Dependencies.Utilities.Types.CanvasContainers
    • ButtonData
    • ButtonData.PressedDelegate
    • FloatingContainer
    • FloatingImage
    • ImageButtonData
    • ResizableContainer
  • GameKit.Dependencies.Utilities.Types.OptionMenuButtons
    • FloatingOptions

Class SyncDictionary<TKey, TValue>

Inheritance
System.Object
FishNet.Object.Synchronizing.Internal.SyncBase
SyncDictionary<TKey, TValue>
Implements
System.Collections.Generic.IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>
System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: FishNet.Object.Synchronizing
Assembly: FishNet.Runtime.dll
Syntax
[Serializable]
public class SyncDictionary<TKey, TValue> : SyncBase, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Type Parameters
Name Description
TKey
TValue

Constructors

SyncDictionary(SyncTypeSettings)

Declaration
public SyncDictionary(SyncTypeSettings settings = default(SyncTypeSettings))
Parameters
Type Name Description
SyncTypeSettings settings

SyncDictionary(Dictionary<TKey, TValue>, SyncTypeSettings)

Declaration
public SyncDictionary(Dictionary<TKey, TValue> objects, SyncTypeSettings settings = default(SyncTypeSettings))
Parameters
Type Name Description
System.Collections.Generic.Dictionary<TKey, TValue> objects
SyncTypeSettings settings

Fields

Collection

Collection of objects.

Declaration
public Dictionary<TKey, TValue> Collection
Field Value
Type Description
System.Collections.Generic.Dictionary<TKey, TValue>

Properties

Count

Number of objects in the collection.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

Item[TKey]

Gets or sets value for a key.

Declaration
public TValue this[TKey key] { get; set; }
Parameters
Type Name Description
TKey key

Key to use.

Property Value
Type Description
TValue

Value when using as Get.

Keys

Keys within the collection.

Declaration
public ICollection<TKey> Keys { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<TKey>

Values

Values within the collection.

Declaration
public ICollection<TValue> Values { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<TValue>

Methods

Add(TKey, TValue)

Adds key and value.

Declaration
public void Add(TKey key, TValue value)
Parameters
Type Name Description
TKey key

Key to add.

TValue value

Value for key.

Add(KeyValuePair<TKey, TValue>)

Adds item.

Declaration
public void Add(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TValue> item

Item to add.

Clear()

Clears all values.

Declaration
public void Clear()

Contains(KeyValuePair<TKey, TValue>)

Returns if item exist.

Declaration
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TValue> item

Item to use.

Returns
Type Description
System.Boolean

True if found.

ContainsKey(TKey)

Returns if key exist.

Declaration
public bool ContainsKey(TKey key)
Parameters
Type Name Description
TKey key

Key to use.

Returns
Type Description
System.Boolean

True if found.

CopyTo(KeyValuePair<TKey, TValue>[], Int32)

Copies collection to an array.

Declaration
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int offset)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TValue>[] array

Array to copy to.

System.Int32 offset

Offset of array data is copied to.

Dirty(TKey)

Dirties an entry by key.

Declaration
public void Dirty(TKey key)
Parameters
Type Name Description
TKey key

Key to dirty.

Dirty(TValue, EqualityComparer<TValue>)

Dirties an entry by value. This operation can be very expensive, will cause allocations, and may fail if your value cannot be compared.

Declaration
public bool Dirty(TValue value, EqualityComparer<TValue> comparer = null)
Parameters
Type Name Description
TValue value

Value to dirty.

System.Collections.Generic.EqualityComparer<TValue> comparer
Returns
Type Description
System.Boolean

True if value was found and marked dirty.

DirtyAll()

Dirties the entire collection forcing a full send.

Declaration
public void DirtyAll()

Finalize()

Declaration
protected void Finalize()

GetCollection(Boolean)

Gets the collection being used within this SyncList.

Declaration
public Dictionary<TKey, TValue> GetCollection(bool asServer)
Parameters
Type Name Description
System.Boolean asServer

True if returning the server value, false if client value. The values will only differ when running as host. While asServer is true the most current values on server will be returned, and while false the latest values received by client will be returned.

Returns
Type Description
System.Collections.Generic.Dictionary<TKey, TValue>

The used collection.

GetEnumerator()

Gets the IEnumerator for the collection.

Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>

Initialized()

Called when the SyncType has been registered, but not yet initialized over the network.

Declaration
protected override void Initialized()
Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.Initialized()

OnStartCallback(Boolean)

Called after OnStartXXXX has occurred.

Declaration
protected override void OnStartCallback(bool asServer)
Parameters
Type Name Description
System.Boolean asServer

True if OnStartServer was called, false if OnStartClient.

Overrides
FishNet.Object.Synchronizing.Internal.SyncBase.OnStartCallback(System.Boolean)

Remove(TKey)

Removes a key.

Declaration
public bool Remove(TKey key)
Parameters
Type Name Description
TKey key

Key to remove.

Returns
Type Description
System.Boolean

True if removed.

Remove(KeyValuePair<TKey, TValue>)

Removes an item.

Declaration
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type Name Description
System.Collections.Generic.KeyValuePair<TKey, TValue> item

Item to remove.

Returns
Type Description
System.Boolean

True if removed.

TryGetValue(TKey, out TValue)

Tries to get value from key.

Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type Name Description
TKey key

Key to use.

TValue value

Variable to output to.

Returns
Type Description
System.Boolean

True if able to output value.

Events

OnChange

Called when the SyncDictionary changes.

Declaration
public event SyncDictionary<TKey, TValue>.SyncDictionaryChanged OnChange
Event Type
Type Description
FishNet.Object.Synchronizing.SyncDictionary.SyncDictionaryChanged<>

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Gets the IEnumerator for the collection.

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator

Implements

System.Collections.Generic.IDictionary<TKey, TValue>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

DictionaryFN.TryGetValueIL2CPP<TKey, TValue>(IDictionary<TKey, TValue>, TKey, out TValue)
DictionaryFN.ValuesToList<TKey, TValue>(IDictionary<TKey, TValue>)
DictionaryFN.ValuesToList<TKey, TValue>(IDictionary<TKey, TValue>, ref List<TValue>)
DictionaryFN.KeysToList<TKey, TValue>(IDictionary<TKey, TValue>)
DictionaryFN.KeysToList<TKey, TValue>(IDictionary<TKey, TValue>, ref List<TKey>)
Arrays.ToString<T>(IEnumerable<T>, String)
In This Article
Back to top Generated by DocFX