Vixen
02b45cc4
csharp
public readonly record struct EntityId

Identity of one entity inside a scene file, independent of any world's handles.

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

Remarks

An Entity is a slot and a version in one world, so it cannot be what a file says. Loading the same scene twice, or entering and leaving play mode, reissues every handle — a file that stored them would name whatever landed in those slots. This is the identity that survives, and it is what a reference from one entity to another, a prefab override and a multi-user session all have to be expressed in.

⚠ A GUID rather than a number counted up from one, and the reason is git. A local counter gives a readable diff and one unreadable failure: two branches each add an entity, each picks the next id, and the merge takes both hunks cleanly — leaving a file with two entities claiming one id, which no tool anywhere reports. A GUID cannot collide, and the noisier diff is the same trade doc 08 already made for assets.

Written as thirty-two lowercase hex digits with no dashes, exactly as AssetId is, so the two read as the same kind of thing in a file.

Fields and properties (4)

  • public Guid Value

    The raw identity.

  • public const int TextLength

    Number of characters ToString writes.

  • public static EntityId None

    No entity.

  • public bool IsNone

    Whether this names nothing.

Methods (10)

  • public EntityId(Guid Value)

    Identity of one entity inside a scene file, independent of any world's handles.

  • public static EntityId New()

    Mints a fresh identity.

  • public override string ToString()

    Returns the fully qualified type name of this instance.

  • public string ToString(string? format, IFormatProvider? formatProvider)

    Formats the value of the current instance using the specified format.

  • public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)

    Tries to format the value of the current instance into the provided span of characters.

  • public static EntityId Parse(string s, IFormatProvider? provider = null)

    Parses a string into a value.

  • public static EntityId Parse(ReadOnlySpan<char> s, IFormatProvider? provider = null)

    Parses a span of characters into a value.

  • public static bool TryParse(string? s, IFormatProvider? provider, out EntityId result)

    Tries to parse a string into a value.

  • public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out EntityId result)

    Tries to parse a span of characters into a value.

  • public static bool TryParse(string? s, out EntityId result)

Used by (16)

  • AuthoringTestsVixen.Editor.AssetEditors.Tests
  • EntityLifetimeTestsVixen.Editor.SceneView.Tests
  • ItemVixen.Editor.SceneView
  • PrefabVixen.Editor.AssetEditors
  • PrefabInstanceTestsVixen.Editor.AssetEditors.Tests
  • PrefabLinkVixen.Editor.AssetEditors
  • SceneCompilerVixen.Editor.Assets
  • SceneDocumentVixen.Editor.SceneView
  • SceneEntityDataVixen.Editor.Core
  • SceneScalarsVixen.Editor.Core
  • SceneSerializerVixen.Editor.SceneView
  • SceneSerializerTestsVixen.Editor.SceneView.Tests
  • SequenceTrackDataVixen.Editor.AssetEditors
  • SubtreeSnapshotVixen.Editor.SceneView
  • TypeRegistrationVixen.Editor.Core
  • Vixen_Editor_AssetEditors_Sequencing_SequenceTrackDataSerializerVixen.Editor.AssetEditors