Vixen
02b45cc4
csharp
public static class SceneBehaviorRegistry

Which behaviour types a scene may name, and how each of them attaches.

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

Remarks

SceneComponentRegistry's twin, and deliberately not an entry in it. The two answer the same question — "what may a scene put on an entity" — about two different kinds of thing: a component is a struct in a chunk that World.Set writes, and a behaviour is a class in a BehaviorStore bucket that Add``1 attaches. Folding behaviours into the component registry would mean a binder whose TypeId and IsTag mean nothing and whose Read writes into a chunk that has no column for it.

⚠ Two registries, one namespace of aliases. A scene entry is written - !PlayerController whichever it is, so the loader asks this and the component registry in turn — see SceneComponentRegistry's Require for what a name neither claims means. Register``1 refuses an alias a component already holds, because a file that names one thing cannot mean two.

Discovered at compile time, exactly as components are. A Behavior subclass carrying [DataContract] is declared here by BehaviorRegistrationGenerator through a [ModuleInitializer] the declaring assembly emits — so what a project can author is what a generator saw in its source, which survives trimming and is the same set in the editor and in a shipped game.

Fields and properties (1)

  • public static IReadOnlyCollection<ISceneBehaviorBinder> Binders

    Every behaviour a scene may name, in the order they were registered.

Methods (5)

  • public static void Declare<T>() where T : Behavior, new()

    Says a behaviour exists, to be registered the first time anything asks.

  • public static void Register<T>() where T : Behavior, new()

    Makes a behaviour type nameable by a scene.

  • public static bool TryGet(string alias, out ISceneBehaviorBinder? binder)

    The binder for a name, if a scene may name it.

  • public static bool TryGet(Type type, out ISceneBehaviorBinder? binder)

    The binder for a behaviour type, if it has one.

  • public static int Evict(Assembly assembly)

    Forgets every behaviour an assembly declared.

Used by (9)

  • BehaviorRegistrationVixen.Engine.Tests
  • BehaviorRegistrationTestsVixen.Engine.Tests
  • BehaviorAuthoringTestsVixen.Editor.App.Tests
  • BehaviorSceneTestsVixen.Editor.SceneView.Tests
  • EditorApplicationVixen.Editor.App
  • ProjectAssembliesVixen.Editor.App
  • ProjectAssemblyTestsVixen.Editor.App.Tests
  • RegisteredVixen.Editor.App
  • SceneSerializerVixen.Editor.SceneView