Vixen
02b45cc4
csharp
public interface IComponentReplicator

Knows how to put one component type on the wire and take it off again.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

One of these is emitted per [Replicated] component by Vixen.Net.Generators. The interface is what the generated code implements, and it is small on purpose: everything the replication loop needs to know about a component type is here, and everything specific to a type is in the generated implementation rather than in a reflection call at run time. That is what makes replication work under NativeAOT.

Hand-written implementations are legitimate — the tests use them, and a type with a layout the generator cannot see is expected to. The generator emits what a careful person would have written.

Fields and properties (7)

  • ComponentTypeId ComponentType

    Which component this replicates.

  • uint TypeId

    The id this type has on the wire: a hash of its full name, computed at build time.

  • string TypeName

    The name, for diagnostics and for the bandwidth attribution panel.

  • Channel Channel

    How to send it.

  • int Priority

    What to shed last. Higher goes first.

  • QueryDescription ChangedQuery

    A query matching entities with this component, filtered on it having changed.

  • ReadOnlySpan<WireLane> Lanes

    The fixed-width fields Write produces, in the order it produces them.

Methods (3)

  • bool Has(World world, Entity entity)

    Whether an entity has this component at all.

  • void Write(World world, Entity entity, ref BitWriter writer)

    Encodes an entity's component.

  • bool Apply(World world, Entity entity, ref BitReader reader)

    Decodes a component and puts it on an entity, adding it if it is not there.

Used by (28)

  • Vixen_Samples_Multiplayer_CombatantReplicatorMultiplayer
  • Vixen_Samples_Multiplayer_VitalsReplicatorMultiplayer
  • FrameVixen.Net
  • HandWrittenTransformReplicatorVixen.Net.Generators.Tests
  • HealthReplicatorVixen.Net.Tests
  • NetworkAnimatorParametersReplicatorVixen.Net.Animation
  • NetworkAnimatorReplicatorVixen.Net.Animation
  • NetworkAudioSourceReplicatorVixen.Net.Audio
  • NetworkBonesReplicatorVixen.Net.Animation
  • NetworkRigidBodyReplicatorVixen.Net.Physics
  • NetworkSpawnReplicatorVixen.Net
  • NetworkTransformReplicatorVixen.Net
  • PositionReplicatorVixen.Net.Tests
  • PredictionHistoryVixen.Net
  • ReplicationClientVixen.Net
  • ReplicationGeneratorTestsVixen.Net.Generators.Tests
  • ReplicationRegistryVixen.Net
  • ReplicationServerVixen.Net
  • SnapshotInspectorVixen.Net
  • SyncListReplicatorVixen.Net.Engine
  • SyncStateReplicatorVixen.Net.Engine
  • Vixen_Net_Generators_Tests_GeneratedPoseReplicatorVixen.Net.Generators.Tests
  • Vixen_Net_Generators_Tests_GeneratedScoreReplicatorVixen.Net.Generators.Tests
  • Vixen_Net_Generators_Tests_GeneratedTransformReplicatorVixen.Net.Generators.Tests
  • CooldownReplicatorVixen.Live.Realm.Tests
  • HandoffCodecVixen.Live.Realm
  • HandoffCodecTestsVixen.Live.Realm.Tests
  • PositionReplicatorVixen.Live.Realm.Tests