Game.Prefabs.AtmospherePrefab
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
AtmospherePrefab is a prefab component used to hold references to textures needed for the in-game moon (albedo and normal maps) and to participate in prefab → ECS conversion by registering the AtmospherePrefabData component. The class is exposed to the Unity editor (ComponentMenu attribute) so textures can be assigned in the inspector. When converting prefabs to entities, it ensures the AtmospherePrefabData component type is included in the component set.
Fields
-
public UnityEngine.Texture2D m_MoonAlbedo
Holds the albedo (diffuse/color) texture for the moon. Assign this in the inspector or via script to control the moon's appearance. -
public UnityEngine.Texture2D m_MoonNormal
Holds the normal map texture for the moon. Assign this in the inspector or via script to provide normal-based lighting detail for the moon surface.
Properties
- None declared in this class.
All data is exposed via public fields; any additional behavior or data used at runtime is provided via the AtmospherePrefabData component registered during prefab conversion.
Constructors
public AtmospherePrefab()
No explicit constructor is defined in the source; the default parameterless constructor provided by C# is used. Initialization of textures is performed by the Unity editor or via script after creating/adding the component.
Methods
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Overrides PrefabBase.GetPrefabComponents to add the ECS component type required by the atmosphere system. Implementation calls the base method and then adds ComponentType.ReadWrite(), ensuring the prefab will include AtmospherePrefabData when converted to entities. This is necessary for the atmosphere-related ECS systems to find and operate on moon/atmosphere data.
Notes: - The class is annotated with [ComponentMenu("Diversity/", new Type[] { })], making it available in the Unity Component menu under the "Diversity" category for easy assignment to GameObjects/prefabs in editor. - AtmospherePrefabData is the ECS data representation referenced here; it holds the runtime data consumed by atmosphere systems (not shown in this file).
Usage Example
// Typical usage in a mod or initialization script:
// - Add or find the AtmospherePrefab component on a prefab/GameObject
// - Assign textures (e.g., loaded from assets)
// - When the engine converts prefabs to entities, AtmospherePrefabData will be included.
var go = new GameObject("MoonPrefab");
var atmospherePrefab = go.AddComponent<Game.Prefabs.AtmospherePrefab>();
atmospherePrefab.m_MoonAlbedo = myLoadedAlbedoTexture;
atmospherePrefab.m_MoonNormal = myLoadedNormalTexture;
// When the prefab conversion runs, GetPrefabComponents ensures
// ComponentType.ReadWrite<AtmospherePrefabData>() is included.