Game.Prefabs.GuideLineSettings
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
GuideLineSettings is a Unity ComponentBase prefab settings class used to configure visual guide-line colors and water source colors for the game's UI/rendering. When a prefab with this component is initialized into the ECS world, it writes a GuideLineSettingsData component and a dynamic buffer of WaterSourceColorElement entries to the entity so systems can read prioritized colors and water-source coloring data at runtime. The class also exposes several Color fields (with defaults) that are editable in the editor.
Nested Types
public class WaterSourceColor
A serializable helper class representing color sets for a water source. Used to populate the dynamic buffer on the entity.public Color m_Outline
— outline color for the water source.public Color m_Fill
— fill color for the water source.public Color m_ProjectedOutline
— outline color when projected.public Color m_ProjectedFill
— fill color when projected.
Fields
-
public Color m_VeryLowPriorityColor
Default: new Color(0.7f, 0.7f, 1f, 0.025f)
Color used to render very-low-priority guide lines (transparent bluish). -
public Color m_LowPriorityColor
Default: new Color(0.7f, 0.7f, 1f, 0.05f)
Color used to render low-priority guide lines. -
public Color m_MediumPriorityColor
Default: new Color(0.7f, 0.7f, 1f, 0.1f)
Color used to render medium-priority guide lines. -
public Color m_HighPriorityColor
Default: new Color(0.7f, 0.7f, 1f, 0.2f)
Color used to render high-priority guide lines. -
public Color m_PositiveFeedbackColor
Default: new Color(0.5f, 1f, 0.5f, 0.1f)
Color used to indicate positive feedback (e.g., valid placement). -
public WaterSourceColor[] m_WaterSourceColors
Array of WaterSourceColor entries. When initializing the prefab, this array is converted into a DynamicBufferon the entity so systems can iterate water-source color entries in ECS.
Properties
- None (no public properties defined by this MonoBehaviour-like component)
Constructors
public GuideLineSettings()
Default constructor. Typical Unity usage is to attach this component to a prefab and configure fields in the inspector; no special construction logic is required.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the ECS component types that this prefab will require:- Adds ComponentType.ReadWrite
() — main settings component for guide-line colors. -
Adds ComponentType.ReadWrite
() — dynamic buffer element type for water source color entries. This informs the prefab-to-entity conversion which components need to be present. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Empty override in this class. (No extra archetype components are added here.) -
public override void Initialize(EntityManager entityManager, Entity entity)
Primary conversion logic executed when the prefab is instantiated as an ECS entity. Behavior: - Calls base.Initialize.
- Constructs a GuideLineSettingsData instance and sets its color fields from the serialized fields on this component, then writes it to the entity with entityManager.SetComponentData(entity, componentData).
- If m_WaterSourceColors is not null, it gets the DynamicBuffer
for the entity, resizes it to the array length, and copies each WaterSourceColor item into the buffer as WaterSourceColorElement entries (mapping m_Outline, m_Fill, m_ProjectedOutline, m_ProjectedFill). - Result: the entity has both the GuideLineSettingsData component and a populated WaterSourceColorElement buffer for runtime systems to consume.
Usage Example
Typical usage is to attach GuideLineSettings to a prefab (Settings/ -> RenderingSettingsPrefab menu) and configure the colors in the inspector. At conversion/initialization the component writes ECS data. Example of how to read the data in an ECS system:
// In a SystemBase or ISystem:
protected override void OnUpdate()
{
// Example: read GuideLineSettingsData from a known settings entity
// (Assuming you have a way to get the entity reference for the settings prefab)
if (EntityManager.HasComponent<GuideLineSettingsData>(settingsEntity))
{
var settings = EntityManager.GetComponentData<GuideLineSettingsData>(settingsEntity);
// Use settings.m_HighPriorityColor, etc.
}
// Example: iterate water source colors buffer
if (EntityManager.HasComponent<WaterSourceColorElement>(settingsEntity))
{
var buffer = EntityManager.GetBuffer<WaterSourceColorElement>(settingsEntity);
for (int i = 0; i < buffer.Length; i++)
{
var ws = buffer[i];
// ws.m_Outline, ws.m_Fill, ws.m_ProjectedOutline, ws.m_ProjectedFill
}
}
}
Notes: - The ECS component types GuideLineSettingsData and WaterSourceColorElement are expected to be defined elsewhere in the codebase; this component simply populates them during prefab initialization. - The ComponentMenu attribute places this MonoBehaviour under "Settings/" in the Unity add-component menu and associates it with RenderingSettingsPrefab.