Game.Prefabs.AudioGroupingMiscSettings
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Prefab component that exposes miscellaneous audio grouping settings to the entity world. It currently provides a single configurable value (m_ForestFireDistance) and, on LateInitialize, writes an AudioGroupingMiscSetting component to the entity so ECS systems can read the value.
Fields
public float m_ForestFireDistance = 100f
Exposed float value representing the distance used by audio grouping logic for forest fires (default 100). This field is intended to be configured on the prefab (in the inspector) and then transferred to an ECS component during LateInitialize.
Properties
- This class does not declare any public properties.
Constructors
public AudioGroupingMiscSettings()
Implicit default constructor. The class relies on Unity/serialization to initialize fields (m_ForestFireDistance defaults to 100f).
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the ECS component type that this prefab will provide to the set of prefab components. Implementation adds ComponentType.ReadWrite() so the entity created from this prefab will include that component. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
No archetype components are added by this class (method is intentionally empty). This method can be used by derived types to contribute to the archetype when creating entities, but here it does nothing. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Called after entity creation to write the runtime component data. This implementation: - Calls base.LateInitialize(entityManager, entity)
- Creates an AudioGroupingMiscSetting instance and sets its m_ForestFireDistance field from the prefab field
- Writes that data to the entity via entityManager.SetComponentData(entity, componentData)
Usage Example
// Example: setting the value on the prefab (via inspector or script) and
// then reading the ECS component after the prefab's LateInitialize has run.
[ComponentMenu("Settings/", new Type[] { typeof(AudioGroupingSettingsPrefab) })]
public class AudioGroupingMiscSettings : ComponentBase
{
public float m_ForestFireDistance = 100f;
// ... methods as in source ...
}
// Later, in some system or initialization code where you have the entity:
AudioGroupingMiscSetting misc = entityManager.GetComponentData<AudioGroupingMiscSetting>(entity);
float forestFireDistance = misc.m_ForestFireDistance;
Notes: - AudioGroupingMiscSetting is the ECS component type written to entities; ensure that struct exists and has a compatible field (m_ForestFireDistance) when using this prefab. - GetPrefabComponents ensures the entity has a writable AudioGroupingMiscSetting component so LateInitialize can SetComponentData without requiring an AddComponent step.