Vixen
02b45cc4
csharp
public sealed class ContentReference<T> where T : class

A pointer from one asset to another, stored as a chunk id and resolved on load.

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

Remarks

A material does not contain its textures; it names them. That is what lets two materials share one texture, what lets the build put them in different bundles, and what makes the chunk graph a graph rather than a set of trees that duplicate everything they share.

What is written is the id and nothing else. The value is filled in at read time, from whatever ContentResolution has in force — which at run time means the object the asset manager has already loaded, so two materials pointing at one texture get the same instance rather than two copies of it.

An unresolved reference is not an error. Reading a chunk with no resolver in force — a tool inspecting content, a test, an editor listing what points at what — gives a reference that knows its id and not its value. That is a useful thing to have and the type says which it is rather than pretending.

Fields and properties (4)

  • public ObjectId Id

    The chunk it points at.

  • public T? Value

    What that chunk loaded to, or if nothing resolved it.

  • public bool IsResolved

    Whether the value is there.

  • public static ContentReference<T> Empty

    A reference to nothing.

Methods (5)

  • public ContentReference(ObjectId id)

    A reference to a chunk, not yet resolved.

  • public ContentReference(ObjectId id, T? value)

    A reference to something already in hand.

  • public T Require()

    What it points at.

  • public void Resolve(T? value)

    Fills in the value. Used by the serializer and by a resolve pass.

  • public override string ToString()

    Returns a string that represents the current object.

Used by (14)

  • AudioEventAssetTestsVixen.Audio.Tests
  • AudioEventBuilderVixen.Audio
  • AudioEventVariantAssetVixen.Audio
  • ContentReferenceSerializerVixen.Core.Serialization
  • ContentReferenceTestsVixen.Assets.Tests
  • LayeredEventTestsVixen.Audio.Tests
  • MusicBuilderVixen.Audio
  • MusicPlayerTestsVixen.Audio.Tests
  • MusicSegmentAssetVixen.Audio
  • ReferringThingVixen.Assets.Tests
  • TypeRegistrationVixen.Audio
  • Vixen_Assets_Tests_ReferringThingSerializerVixen.Assets.Tests
  • Vixen_Audio_Assets_AudioEventVariantAssetSerializerVixen.Audio
  • Vixen_Audio_Assets_MusicSegmentAssetSerializerVixen.Audio