Game.Prefabs.DecalProperties
Assembly: Game
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
DecalProperties is a Component used to configure rendering-related properties for a decal prefab. It exposes the decal texture area, the renderer priority, a layer mask (flags) indicating which decal layers the decal should affect, and a toggle for whether the decal should use infoview coloring. The class is decorated with a ComponentMenu attribute so it can be added via the editor menu under "Rendering/". The m_LayerMask field uses a BitMask attribute to indicate a flags-style enum selection in the editor.
Fields
-
public Bounds2 m_TextureArea = new Bounds2(0f, 1f)
Defines the UV or normalized texture area for the decal. Default initialized to the full range (0 to 1). Type Bounds2 comes from Colossal.Mathematics and represents a 1D bounds used by the rendering system. -
public int m_RendererPriority
Integer priority used by the decal rendering pipeline to determine ordering between decal renderers. Lower or higher priority semantics depend on the renderer (documented elsewhere in the engine). -
public DecalLayers m_LayerMask = DecalLayers.Terrain | DecalLayers.Roads | DecalLayers.Buildings
A flags enum (DecalLayers) indicating which decal layers this decal should be applied to. Decorated with [BitMask] so it appears as a multi-select mask in the editor. Default includes Terrain, Roads and Buildings. -
public bool m_EnableInfoviewColor
When true, the decal uses the game's infoview (overlay) coloring, allowing the decal to visually respond to in-game overlay modes.
Properties
- This class defines no C# properties. It exposes public fields for configuration.
Constructors
public DecalProperties()
Default parameterless constructor. Field initializers set reasonable defaults (m_TextureArea to full [0,1], m_LayerMask to Terrain | Roads | Buildings). No additional initialization logic is present in the source.
Methods
-
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Overridden from ComponentBase. In the current implementation the method body is empty. In the engine this method is normally used to add required ComponentType entries for entity archetypes, but DecalProperties does not register any archetype components here. -
public override void GetPrefabComponents(HashSet<ComponentType> components)
Overridden from ComponentBase. Also empty in this implementation. This method would normally add component types required by prefab instances; here it is intentionally left blank.
Usage Example
// Example: add/configure DecalProperties on a prefab or GameObject at runtime
using Colossal.Mathematics;
using Game.Prefabs;
using UnityEngine;
public class DecalSetup : MonoBehaviour
{
void Awake()
{
var decal = gameObject.AddComponent<DecalProperties>();
decal.m_TextureArea = new Bounds2(0f, 1f); // full texture
decal.m_RendererPriority = 10;
decal.m_LayerMask = DecalLayers.Terrain | DecalLayers.Roads;
decal.m_EnableInfoviewColor = true;
}
}
{{ Additional notes: - The class relies on engine-specific types (Bounds2, DecalLayers, ComponentType) from Colossal's codebase; consult the game's modding API for details about how these interact with the rendering and prefab systems. - The two empty override methods suggest that this component is intended only as a data container used by other parts of the renderer rather than directly registering ECS components itself. }}