Skip to content

Game.Prefabs.MarkerObjectPrefab

Assembly: Game
Namespace: Game.Prefabs

Type: public class

Base: ObjectPrefab

Summary:
Prefab class used for marker objects in the game. Exposes a RenderPrefab reference used to supply mesh/visuals and a boolean flag indicating whether the marker is circular. Overrides prefab lifecycle methods to declare asset dependencies and the ECS component types required by instances of this prefab (both for prefab data and for the runtime archetype).


Fields

  • public RenderPrefab m_Mesh
    Reference to the mesh/render prefab used to draw the marker. This is added to dependency lists so the renderer prefab is included/loaded with the marker prefab.

  • public bool m_Circular
    Flag indicating whether the marker should be treated as circular (affects rendering/placement behavior).

Properties

  • None
    This prefab does not declare additional properties beyond the public fields above.

Constructors

  • public MarkerObjectPrefab()
    Default constructor (no custom initialization in source). Instances are typically created/managed by the Unity editor or mod asset loading code.

Methods

  • public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
    Adds the RenderPrefab referenced by m_Mesh to the provided dependency list. Calls base.GetDependencies(prefabs) first to include any base-class dependencies.

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Declares component types that the prefab requires on the prefab entity/data: it adds ObjectGeometryData and SubMesh (both as ReadWrite) after calling base.GetPrefabComponents(components). These represent per-prefab geometry/submesh data needed for rendering/instantiation.

  • public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Declares component types required for the runtime archetype (entities created from this prefab). After calling base.GetArchetypeComponents(components), it adds the following ReadWrite component types:

  • Static
  • Marker
  • CullingInfo
  • MeshBatch
  • PseudoRandomSeed These components support static placement, marker-specific behavior, culling, mesh batching and a pseudo-random seed for per-instance variation.

Usage Example

// Example: create/configure a MarkerObjectPrefab at runtime (usually created in editor)
var prefab = ScriptableObject.CreateInstance<Game.Prefabs.MarkerObjectPrefab>();
prefab.m_Mesh = myRenderPrefab; // assign a RenderPrefab asset
prefab.m_Circular = true;

// gather dependencies (e.g., as part of an asset/pack build step)
var deps = new List<PrefabBase>();
prefab.GetDependencies(deps);

// gather prefab component types (for editor validation or tooling)
var prefabComponents = new HashSet<Unity.Entities.ComponentType>();
prefab.GetPrefabComponents(prefabComponents);

// gather archetype components (used to build the ECS archetype for instances)
var archetypeComponents = new HashSet<Unity.Entities.ComponentType>();
prefab.GetArchetypeComponents(archetypeComponents);