Docs / ECS

Glossary: ComponentDefaults

The method of ComponentDefaults.

Color legend method

The starting value of a component added by type without one, by ECSWorld.AddComponent(entity, type).

A static class, in the namespace BorrowedTorch.ECS.Components.Store. A component type declares its default as a public static field or property named Default or Identity whose type is the component’s own, Default first; a member of another type with one of those names is ignored. The type-erased access page shows it in context, with code.

Names are colored by what they are: a method.

Methods

Create() →

Create(Type componentType) · Static. The type’s declared default, boxed; for a struct that declares none, a zeroed value, and for a class that declares none, null. A property is read on every call, a field gives the same object every time. Throws ArgumentNullException for null, and ArgumentException for a type that doesn’t implement IComponent.

Parameter Type Description
componentType Type The component’s type.