Class SnapshotCharacter
Lightweight phantom ICharacter implementation that preserves a frozen snapshot of character identity and attribute data. Created when a caster disconnects so that detached AbilityObjects can continue to resolve stat-scaled calculations via StatScaledValue and StatScaledFloatValue without a live networked character.
Only TryGet<T>(out T) for ICharacterAttributeController is supported.
All other behaviour lookups return false, causing downstream systems
(achievements, factions, etc.) to gracefully degrade.
public sealed class SnapshotCharacter : ICharacter
- Inheritance
-
SnapshotCharacter
- Implements
- Inherited Members
- Extension Methods
Constructors
SnapshotCharacter(ICharacter, Transform)
Creates a phantom character snapshot from a live ICharacter. Copies identity data and snapshots all character attributes.
public SnapshotCharacter(ICharacter liveCharacter, Transform abilityObjectTransform)
Parameters
liveCharacterICharacterThe live character to snapshot. Must not be null.
abilityObjectTransformTransformThe transform to use as the phantom's Transform reference. Typically the Transform so positional queries resolve to the projectile's location rather than a stale character position.
Properties
CharacterGuildLabel
The label displaying the character's guild above their model.
public WorldLabel CharacterGuildLabel { get; set; }
Property Value
CharacterNameLabel
The label displaying the character's name above their model.
public WorldLabel CharacterNameLabel { get; set; }
Property Value
Collider
The collider for the character.
public Collider Collider { get; set; }
Property Value
- Collider
Flags
Bitwise flags representing the character's state.
public int Flags { get; set; }
Property Value
GameObject
The GameObject associated with the character.
public GameObject GameObject { get; }
Property Value
- GameObject
ID
Unique identifier for the character.
public long ID { get; set; }
Property Value
IsSpawned
Always returns true so that AbilityObject.OnTick and its swept hit
resolution continue to dispatch ECA events through the phantom caster.
public bool IsSpawned { get; }
Property Value
Remarks
CONTRACT: This MUST return true. Both AbilityObject.OnTick
and AbilityObject.DispatchSweptHit guard event dispatch with
Caster != null && Caster.IsSpawned. Returning false
would silently suppress all tick and hit events on every detached
ability object for the remainder of its lifetime.
IsTeleporting
Whether the character is currently teleporting.
public bool IsTeleporting { get; }
Property Value
MeshRoot
The root transform for the character's mesh/model hierarchy.
public Transform MeshRoot { get; }
Property Value
- Transform
Name
The character's display name.
public string Name { get; }
Property Value
NetworkObject
The network object representing this character in FishNet networking.
public NetworkObject NetworkObject { get; }
Property Value
- NetworkObject
Observers
The set of network connections observing this character.
public HashSet<NetworkConnection> Observers { get; }
Property Value
- HashSet<NetworkConnection>
Owner
The network connection that owns this character.
public NetworkConnection Owner { get; }
Property Value
- NetworkConnection
PredictionManager
The prediction manager for client-side prediction and reconciliation.
public PredictionManager PredictionManager { get; }
Property Value
- PredictionManager
Transform
The transform of the character.
public Transform Transform { get; }
Property Value
- Transform
Methods
DisableFlags(CharacterFlags)
Disables the specified flags for the character using bitwise operations.
public void DisableFlags(CharacterFlags flags)
Parameters
flagsCharacterFlagsFlags to disable.
EnableFlags(CharacterFlags)
Enables the specified flags for the character using bitwise operations.
public void EnableFlags(CharacterFlags flags)
Parameters
flagsCharacterFlagsFlags to enable.
FromLive(ICharacter, Transform)
Creates a SnapshotCharacter from a live caster, freezing identity and attribute data so that detached ability objects can continue to resolve stat-scaled calculations.
public static SnapshotCharacter FromLive(ICharacter liveCaster, Transform abilityObjectTransform)
Parameters
liveCasterICharacterThe live character to snapshot.
abilityObjectTransformTransformThe ability object's transform, used as the phantom's positional reference.
Returns
- SnapshotCharacter
A new SnapshotCharacter or null if
liveCasteris null.
InstantiateRaceModelFromIndex(RaceTemplate, int)
Instantiates the character's race model prefab at the specified index and attaches it to the mesh root.
public void InstantiateRaceModelFromIndex(RaceTemplate raceTemplate, int modelIndex)
Parameters
raceTemplateRaceTemplateThe race template containing model references.
modelIndexintThe 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.
public void InstantiateRaceModelFromIndex(RaceTemplate raceTemplate, int modelIndex, CharacterGender gender)
Parameters
raceTemplateRaceTemplateThe race template containing model references.
modelIndexintThe index of the model to instantiate.
genderCharacterGenderThe 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
triggersList<Trigger>The list of triggers to execute.
eventDataEventDataThe event data to pass to each trigger.
IsFlagged(CharacterFlags)
Checks if the specified flags are enabled for the character.
public bool IsFlagged(CharacterFlags flags)
Parameters
flagsCharacterFlagsFlags to check.
Returns
- bool
True if the flags are enabled; otherwise, false.
RegisterCharacterBehaviour(ICharacterBehaviour)
Registers a character behaviour component for this character. Enables behaviour-based extension and modular logic.
public void RegisterCharacterBehaviour(ICharacterBehaviour behaviour)
Parameters
behaviourICharacterBehaviour
Remarks
SnapshotCharacter only supports ICharacterAttributeController.
Registering other behaviour types is a no-op. This avoids GetInterfaces()
reflection which is fragile under IL2CPP code stripping.
TryGet<T>(out T)
Attempts to get a registered character behaviour of type T. Returns true if found, with the behaviour in the out parameter.
public bool TryGet<T>(out T control) where T : class, ICharacterBehaviour
Parameters
controlTThe behaviour instance if found, otherwise null.
Returns
- bool
True if the behaviour is found; otherwise, false.
Type Parameters
TThe interface type to retrieve.
UnregisterCharacterBehaviour(ICharacterBehaviour)
Unregisters a character behaviour component from this character.
public void UnregisterCharacterBehaviour(ICharacterBehaviour behaviour)
Parameters
behaviourICharacterBehaviour
Remarks
SnapshotCharacter only supports ICharacterAttributeController. Unregistering other behaviour types is a no-op.