Game.Prefabs.LodProperties
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Represents level-of-detail (LOD) settings for a prefab. Exposes bias values (for LOD selection and shadow LOD) and an array of RenderPrefab references that represent the different LOD mesh prefabs. Integrates with the project's prefab dependency discovery and declares the required ECS component (LodMesh) for prefabs that include this component. Marked with a ComponentMenu attribute so it appears under "Rendering/" in the editor.
Fields
-
public float m_Bias
Bias value used to influence LOD selection for this prefab instance. -
public float m_ShadowBias
Bias value used specifically for shadow LOD selection (may differ from m_Bias). -
public RenderPrefab[] m_LodMeshes
Array of RenderPrefab references that provide the actual LOD meshes (one entry per LOD level). These entries are collected as prefab dependencies when GetDependencies is called.
Properties
- No public properties are exposed by this class.
Constructors
public LodProperties()
Default constructor (implicit). The class does not define custom constructor logic.
Methods
-
public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
Adds any referenced RenderPrefab entries from m_LodMeshes to the provided prefabs list. This ensures those prefabs are discovered and included as dependencies when building or serializing scenes/prefabs. If m_LodMeshes is null, nothing is added. -
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Adds the ECS component requirement ComponentType.ReadWrite() to the supplied components set. This declares that prefabs with this component require an entity component of type LodMesh at runtime. -
public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Empty implementation. No extra archetype components are declared here. The method is left intentionally blank.
Usage Example
// Example: creating and querying dependencies from LodProperties in code
var lodProps = new Game.Prefabs.LodProperties
{
m_Bias = 1.0f,
m_ShadowBias = 0.5f,
m_LodMeshes = new RenderPrefab[] { /* assign RenderPrefab references */ }
};
var deps = new List<PrefabBase>();
lodProps.GetDependencies(deps);
// 'deps' now contains any RenderPrefab entries referenced in m_LodMeshes
{{ Additional notes: - The class is annotated with [ComponentMenu("Rendering/", new Type[] { typeof(RenderPrefab) })], which places it in the editor menu under Rendering for easy attachment to prefabs. - GetPrefabComponents declares that the prefab will require a LodMesh ECS component; systems or conversion logic should ensure that LodMesh data is created/filled during prefab-to-entity conversion. - GetArchetypeComponents is intentionally empty — no extra archetype-level ECS components are imposed beyond what GetPrefabComponents provides. }}