Table of Contents

Class BaseCharacter

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Abstract base class for all networked character entities in the game. Provides core properties, behaviour registration, flag management, and prefab/model instantiation.

[RequireComponent(typeof(NetworkObject))]
[RequireComponent(typeof(NetworkTransformDistanceLod))]
public abstract class BaseCharacter : NetworkBehaviour, ICharacter
Inheritance
Object
Component
Behaviour
MonoBehaviour
NetworkBehaviour
BaseCharacter
Implements
Derived
Inherited Members
NetworkBehaviour.IsSpawned
NetworkBehaviour.ComponentIndex
NetworkBehaviour.NetworkObject
NetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURS
NetworkBehaviour.UNSET_NETWORKBEHAVIOUR_ID
NetworkBehaviour.ToString()
NetworkBehaviour.Reset()
NetworkBehaviour.OnValidate()
NetworkBehaviour.IsBehaviourReconciling
NetworkBehaviour.ClearReplicateCache()
NetworkBehaviour.CreateReconcile()
NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)
NetworkBehaviour.OnStartServerCalled
NetworkBehaviour.OnStartClientCalled
NetworkBehaviour.WritePayload(NetworkConnection, Writer)
NetworkBehaviour.ReadPayload(NetworkConnection, Reader)
NetworkBehaviour.OnStartNetwork()
NetworkBehaviour.OnStopNetwork()
NetworkBehaviour.OnStartServer()
NetworkBehaviour.OnStopServer()
NetworkBehaviour.OnOwnershipServer(NetworkConnection)
NetworkBehaviour.OnSpawnServer(NetworkConnection)
NetworkBehaviour.OnDespawnServer(NetworkConnection)
NetworkBehaviour.OnStartClient()
NetworkBehaviour.OnStopClient()
NetworkBehaviour.OnOwnershipClient(NetworkConnection)
NetworkBehaviour.ClearBuffedRpcs()
NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcs
NetworkBehaviour.IsClientOnly
NetworkBehaviour.IsServerOnly
NetworkBehaviour.IsHost
NetworkBehaviour.IsClient
NetworkBehaviour.IsServer
NetworkBehaviour.IsDeinitializing
NetworkBehaviour.NetworkManager
NetworkBehaviour.ServerManager
NetworkBehaviour.ClientManager
NetworkBehaviour.ObserverManager
NetworkBehaviour.TransportManager
NetworkBehaviour.TimeManager
NetworkBehaviour.SceneManager
NetworkBehaviour.PredictionManager
NetworkBehaviour.RollbackManager
NetworkBehaviour.NetworkObserver
NetworkBehaviour.IsClientInitialized
NetworkBehaviour.IsClientStarted
NetworkBehaviour.IsClientOnlyInitialized
NetworkBehaviour.IsClientOnlyStarted
NetworkBehaviour.IsServerInitialized
NetworkBehaviour.IsServerStarted
NetworkBehaviour.IsServerOnlyInitialized
NetworkBehaviour.IsServerOnlyStarted
NetworkBehaviour.IsHostInitialized
NetworkBehaviour.IsHostStarted
NetworkBehaviour.IsOffline
NetworkBehaviour.IsNetworked
NetworkBehaviour.GetIsNetworked()
NetworkBehaviour.IsManagerReconciling
NetworkBehaviour.Observers
NetworkBehaviour.IsOwner
NetworkBehaviour.IsController
NetworkBehaviour.HasAuthority
NetworkBehaviour.Owner
NetworkBehaviour.OwnerId
NetworkBehaviour.ObjectId
NetworkBehaviour.LocalConnection
NetworkBehaviour.OwnerMatches(NetworkConnection)
NetworkBehaviour.Despawn(GameObject, DespawnType?)
NetworkBehaviour.Despawn(NetworkObject, DespawnType?)
NetworkBehaviour.Despawn(DespawnType?)
NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)
NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)
NetworkBehaviour.RemoveOwnership()
NetworkBehaviour.GiveOwnership(NetworkConnection)
NetworkBehaviour.GetInstance<T>()
NetworkBehaviour.TryRegisterInstance<T>(T)
NetworkBehaviour.UnregisterInstance<T>()
NetworkBehaviour.CanLog(LoggingType)
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.name
Object.hideFlags
Extension Methods

Remarks

Why the distance LOD is required. State forwarding is off on every character, so a NetworkTransform is the only thing that carries a character's position to anyone observing it — and an unfiltered NetworkTransform sends every observer every update at full tick rate regardless of distance. NetworkTransformDistanceLod is what installs the per-observer send filter that bands those updates by distance; without it a character is the single largest line in every observer's budget. It in turn requires the NetworkTransform itself, so this one attribute pins the whole interpolated transport onto every character that ships.

Fields

Behaviours

Dictionary mapping behaviour interface types to their implementations for this character.

protected Dictionary<Type, ICharacterBehaviour> Behaviours

Field Value

Dictionary<Type, ICharacterBehaviour>

ClientCharacters

Client-side dictionary mapping character IDs to their instances for quick lookup. This is populated when characters are read from the network payload and cleared when they are destroyed. Characters are also removed from this dictionary when their state is reset, such as during despawning or scene transitions.

public static Dictionary<long, ICharacter> ClientCharacters

Field Value

Dictionary<long, ICharacter>

Properties

CharacterGuildLabel

The label displaying the character's guild above their model.

public WorldLabel CharacterGuildLabel { get; set; }

Property Value

WorldLabel

CharacterNameLabel

The label displaying the character's name above their model.

public WorldLabel CharacterNameLabel { get; set; }

Property Value

WorldLabel

Collider

Collider attached to the character, used for physics and interactions.

public Collider Collider { get; set; }

Property Value

Collider

Flags

Bitwise flags representing character state and attributes.

public int Flags { get; set; }

Property Value

int

GameObject

Cached reference to the character's GameObject.

public GameObject GameObject { get; }

Property Value

GameObject

ID

Unique network identifier for this character.

public long ID { get; set; }

Property Value

long

IsTeleporting

Indicates if the character is currently teleporting. Override in derived classes for custom logic.

public virtual bool IsTeleporting { get; }

Property Value

bool

LocalTick

The current local TimeManager tick for this character's context. Exposed as a convenience for callers that need the absolute tick.

public uint LocalTick { get; }

Property Value

uint

MeshRoot

The root transform for the character's mesh/model hierarchy.

public Transform MeshRoot { get; }

Property Value

Transform

Name

The name of the character, mapped to the GameObject's name.

public string Name { get; }

Property Value

string

NetworkAnimator

NetworkAnimator component for synchronizing animation parameters across the network. Configured at runtime after the character model is instantiated.

public NetworkAnimator NetworkAnimator { get; }

Property Value

NetworkAnimator

Transform

Cached reference to the character's Transform component.

public Transform Transform { get; }

Property Value

Transform

Methods

DisableFlags(CharacterFlags)

Disables the specified character flags using bitwise operations.

public void DisableFlags(CharacterFlags flags)

Parameters

flags CharacterFlags

Flags to disable.

EnableFlags(CharacterFlags)

Enables the specified character flags using bitwise operations.

public void EnableFlags(CharacterFlags flags)

Parameters

flags CharacterFlags

Flags to enable.

Get<T>()

Retrieves a registered character behaviour for the specified interface type, or null if not found.

public T Get<T>() where T : class, ICharacterBehaviour

Returns

T

The behaviour instance if found; otherwise, null.

Type Parameters

T

The interface type to retrieve.

InstantiateRaceModelFromIndex(RaceTemplate, int)

Instantiates the character's race model prefab at the specified index and attaches it to the mesh root. Removes any previous child models except for labels and special points.

public void InstantiateRaceModelFromIndex(RaceTemplate raceTemplate, int modelIndex)

Parameters

raceTemplate RaceTemplate

The race template containing model references.

modelIndex int

The index of the model to instantiate.

InstantiateRaceModelFromIndex(RaceTemplate, int, CharacterGender)

Instantiates the character's race model prefab at the specified gender and index and attaches it to the mesh root. Removes any previous child models except for labels and special points.

public void InstantiateRaceModelFromIndex(RaceTemplate raceTemplate, int modelIndex, CharacterGender gender)

Parameters

raceTemplate RaceTemplate

The race template containing model references.

modelIndex int

The index of the model to instantiate.

gender CharacterGender

The model gender to request.

Invoke(List<Trigger>, EventData)

Executes each trigger in the list with the supplied event data. Null-safe: no-ops if triggers or eventData is null.

public void Invoke(List<Trigger> triggers, EventData eventData)

Parameters

triggers List<Trigger>

The list of triggers to execute.

eventData EventData

The event data to pass to each trigger.

IsFlagged(CharacterFlags)

Checks if the specified character flags are enabled.

public bool IsFlagged(CharacterFlags flags)

Parameters

flags CharacterFlags

Flags to check.

Returns

bool

True if the flags are enabled; otherwise, false.

OnAwake()

Called after all CharacterBehaviours have called InitializeOnce. Override for custom initialization logic.

public virtual void OnAwake()

OnDestroying()

Called when the object is being destroyed. Override for custom cleanup logic.

public virtual void OnDestroying()

RegisterCharacterBehaviour(ICharacterBehaviour)

Registers a character behaviour implementation for all supported interfaces. Only interfaces derived from ICharacterBehaviour are registered.

public void RegisterCharacterBehaviour(ICharacterBehaviour behaviour)

Parameters

behaviour ICharacterBehaviour

The behaviour instance to register.

TryGet<T>(out T)

Attempts to retrieve a registered character behaviour for the specified interface type.

public bool TryGet<T>(out T control) where T : class, ICharacterBehaviour

Parameters

control T

The behaviour instance if found, otherwise null.

Returns

bool

True if the behaviour is found; otherwise, false.

Type Parameters

T

The interface type to retrieve.

UnregisterCharacterBehaviour(ICharacterBehaviour)

Unregisters a character behaviour implementation for all supported interfaces. Removes the behaviour from the dictionary for each interface it implements.

public void UnregisterCharacterBehaviour(ICharacterBehaviour behaviour)

Parameters

behaviour ICharacterBehaviour

The behaviour instance to unregister.