Game.RenderedArea
Assembly:
Assembly-CSharp
Namespace:
Game.Prefabs
Type:
class
Base:
ComponentBase
Summary:
RenderedArea is a ComponentBase-derived prefab component used by area-type prefabs (e.g., surface and lot prefabs). It exposes rendering-related options such as the material to render the area with, roundness for edge smoothing, LOD bias, renderer priority, and a decal layer bitmask. The component registers required entity components when converting the prefab to an ECS entity (adds RenderedAreaData and Batch components via prefab/archetype methods). The ComponentMenu attribute places this component in the editor menu under "Areas/" for SurfacePrefab and LotPrefab types.
Fields
-
public UnityEngine.Material m_Material
Material used to render the area surface. Assign the shader/material that should be used for this rendered area. -
public float m_Roundness = 0.5f
Controls corner/edge roundness (smoothing) for the rendered area. Typical range is 0..1; higher values produce softer or more rounded edges depending on shader usage. -
public float m_LodBias
Level-of-detail bias applied to the renderer for this area, affecting which LOD is chosen during rendering. -
public int m_RendererPriority
Priority/order value used by the renderer to determine render ordering relative to other renderers. -
[BitMask] public DecalLayers m_DecalLayerMask = DecalLayers.Terrain
Bitmask selecting which decal layers affect this area (default: Terrain). Use this to include/exclude decal layers for the area.
Properties
- This class does not declare public properties.
Constructors
public RenderedArea()
Default constructor (no explicit initialization beyond field defaults). The class relies on Unity/engine construction and inspector assignment for configuration.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Called when the prefab is being prepared for conversion to an entity prefab. Adds the required runtime component type(s) for prefab instances. In this implementation it addsRenderedAreaData
(read/write) to the provided components set so that entities spawned from the prefab receive that component. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Called when forming an entity archetype for the prefab. AddsBatch
(read/write) to the archetype components set so entities have the necessary batching component for rendering.
Usage Example
// Example: add RenderedArea to a prefab GameObject and configure it
using UnityEngine;
using Game.Prefabs;
public class CreateRenderedAreaExample : MonoBehaviour
{
void Start()
{
var go = new GameObject("MyRenderedArea");
var renderedArea = go.AddComponent<RenderedArea>();
// assign a material (must be a valid Material from project/assets)
renderedArea.m_Material = Resources.Load<Material>("Materials/MyAreaMaterial");
// configure appearance and rendering
renderedArea.m_Roundness = 0.6f;
renderedArea.m_LodBias = 0.0f;
renderedArea.m_RendererPriority = 10;
// set decal layers (example: apply to Terrain and Props layers if available)
renderedArea.m_DecalLayerMask = DecalLayers.Terrain; // combine flags as needed
// The prefab conversion pipeline will call GetPrefabComponents/GetArchetypeComponents
// to ensure the entity gets RenderedAreaData and Batch components.
}
}