Skip to content

Game.Prefabs.ImpostorData

Assembly:
Assembly-CSharp (inferred — the assembly containing game code / mod code)

Namespace: Game.Prefabs

Type:
struct

Base:
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
ImpostorData is a lightweight ECS component used to store simple per-entity impostor (billboard/LOD) parameters: a local offset and a size. Typical usage is attaching this component to entities that represent simple visual impostors or low-detail prefabs so systems and rendering code can query the offset (float3) and size (float) when positioning or scaling the impostor representation.


Fields

  • public Unity.Mathematics.float3 m_Offset
    Stores a local-space offset applied to the impostor's position. Use this to adjust the visual origin of the impostor relative to the entity's transform. The value is a float3 from Unity.Mathematics (x,y,z). Units are in world units (same scale as entity positions).

  • public System.Single m_Size
    A scalar representing the impostor's size (scale). Typically used to scale the impostor quad or influence LOD decisions. Units are world units (or a uniform scale factor depending on how rendering code interprets it).

Properties

  • None. (This struct exposes fields directly; no C# properties are declared.)

Constructors

  • Implicit default constructor (public ImpostorData())
    Since this is a struct, a default parameterless constructor is provided by the runtime. Construct and populate fields directly when creating an instance, or set values when adding the component to an entity.

Example:

var impostor = new ImpostorData { m_Offset = new float3(0f, 1f, 0f), m_Size = 2f };

Methods

  • None. (No methods are declared on this struct. Behavior is expected to be implemented in ECS systems that read/write this component.)

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;

// Adding to an existing entity via EntityManager
var impostor = new ImpostorData { m_Offset = new float3(0f, 1.5f, 0f), m_Size = 1.2f };
entityManager.AddComponentData(entity, impostor);

// Or using an EntityCommandBuffer inside a system
var ecb = new EntityCommandBuffer(Allocator.Temp);
ecb.AddComponent(entity, new ImpostorData { m_Offset = new float3(0f, 0.5f, 0f), m_Size = 0.8f });
ecb.Playback(entityManager);
ecb.Dispose();

Additional notes: - Because this implements IComponentData, it's intended for use on entities in the Unity Entities (DOTS) workflow. - IQueryTypeParameter allows the type to be used conveniently in query definitions (depending on Unity.Entities version). - Use float3 from Unity.Mathematics for deterministic and burst-compatible math operations in systems that process this component.