Skip to content

Game.Prefabs.GrowthScaleData

Assembly:
Assembly-CSharp (game assembly; may appear in the game's runtime assembly that contains game types)

Namespace:
Game.Prefabs

Type:
struct (value type)

Base:
IComponentData, IQueryTypeParameter

Summary:
Component data that stores per-age-stage scale vectors for a prefab/entity. Each field is a float3 representing the local scale to be used for that life stage (Child, Teen, Adult, Elderly, Dead). Intended for use with Unity's ECS (DOTS) in the game's growth/ageing systems to drive visual scaling of prefabs as they change age states.


Fields

  • public float3 m_ChildSize
    Scale to apply when the entity is in the Child age stage. Typical use: smaller than adult scale.

  • public float3 m_TeenSize
    Scale to apply when the entity is in the Teen age stage. Typical use: intermediate size between child and adult.

  • public float3 m_AdultSize
    Scale to apply when the entity is in the Adult age stage. Often the default or baseline visual scale.

  • public float3 m_ElderlySize
    Scale to apply when the entity is in the Elderly age stage. May be same as adult or slightly different per design.

  • public float3 m_DeadSize
    Scale to apply when the entity is dead (wreckage/decay visuals). Often represents collapsed or flattened scale.

Properties

  • This type has no properties. It exposes only public fields and implements IComponentData for use as a component.

Constructors

  • public GrowthScaleData()
    This struct uses the default value-type constructor. All float3 fields default to float3.zero unless explicitly initialized. It is recommended to initialize fields when adding this component to an entity.

Methods

  • This type defines no methods.

Usage Example

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

// Example: create an entity with GrowthScaleData via an EntityManager
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = em.CreateArchetype(typeof(GrowthScaleData));
var ent = em.CreateEntity(archetype);

var scales = new GrowthScaleData
{
    m_ChildSize = new float3(0.5f, 0.5f, 0.5f),
    m_TeenSize = new float3(0.8f, 0.8f, 0.8f),
    m_AdultSize = new float3(1f, 1f, 1f),
    m_ElderlySize = new float3(0.95f, 0.95f, 0.95f),
    m_DeadSize = new float3(1f, 0.2f, 1f) // example flattened dead scale
};

em.SetComponentData(ent, scales);

// Or from a SystemBase:
protected override void OnCreate()
{
    base.OnCreate();
    var e = EntityManager.CreateEntity(typeof(GrowthScaleData));
    EntityManager.SetComponentData(e, new GrowthScaleData
    {
        m_ChildSize = new float3(0.6f),
        m_TeenSize = new float3(0.9f),
        m_AdultSize = new float3(1f),
        m_ElderlySize = new float3(0.95f),
        m_DeadSize = new float3(1f, 0.3f, 1f)
    });
}