Game.Prefabs.ClipArea
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
ClipArea is a prefab-component class used to mark an area prefab as a "clip" area for the game's area systems. It is decorated with a ComponentMenu attribute so it appears under the Areas/ menu in the editor (accepting SurfacePrefab in that menu). At runtime it contributes the Clip component to the entity archetype so systems that operate on Clip components will include entities created from prefabs that contain this component. The class intentionally provides no prefab-only components via GetPrefabComponents and only adds the runtime component via GetArchetypeComponents.
Fields
- None
This class declares no fields.
Properties
- None
No public or private properties are declared on this class.
Constructors
public ClipArea()
This class does not declare an explicit constructor; the default public parameterless constructor is used.
Methods
-
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
This override is intentionally empty. It does not add any editor/prefab-only components to the provided set. -
public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
AddsComponentType.ReadWrite<Clip>()
to the provided set. This ensures that entities created from a prefab containing this ClipArea will include a writable Clip component in their ECS archetype, enabling area/clip-related systems to find and operate on them.
Additional notes:
- The file includes using Game.Areas;
so the Clip type referenced is expected to be defined in that namespace.
- The [ComponentMenu("Areas/", new Type[] { typeof(SurfacePrefab) })]
attribute makes this component accessible from the editor menu under Areas/ and associates it with SurfacePrefab types.
Usage Example
// If a prefab contains the ClipArea component, when its archetype is built
// the following component will be added to the archetype:
ComponentType.ReadWrite<Clip>()
// Example: adding ClipArea in the editor (via ComponentMenu) or via code:
var go = new GameObject("MyAreaPrefab");
go.AddComponent<Game.Prefabs.ClipArea>();
// When the prefab system queries GetArchetypeComponents for this prefab,
// it will receive ComponentType.ReadWrite<Clip>(), so created entities
// will have a Clip component available at runtime.