Game.Prefabs.TerrainMaterialProperties
Assembly:
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Component used on prefab definitions to carry terrain-related material data (a texture reference). It is decorated with a ComponentMenu attribute so it appears under Tools/ in prefab authoring tools and is associated with TerraformingPrefab. The class exposes a single Texture field and provides overrides for Unity.Entities integration methods (GetPrefabComponents / GetArchetypeComponents) that are currently empty — meaning this component does not add any additional ECS ComponentType entries by itself in the provided implementation.
Fields
public UnityEngine.Texture m_Texture
Texture reference used to describe the terrain material for the prefab. Typically set in the prefab inspector to point to the texture used by the terrain material.
Properties
- This class does not define any public properties.
Constructors
public TerrainMaterialProperties()
Default parameterless constructor (implicit if not declared). Initializes a new instance of the component as used by Unity/authoring workflows.
Methods
-
public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Override intended to add ECS ComponentType entries needed by this prefab when converting to an entity prefab. Implementation is empty in this class, so it does not add any component types. -
public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
Override intended to add ECS ComponentType entries needed when creating an archetype for this prefab at runtime. Implementation is empty in this class, so it does not add any component types.
Usage Example
// Example: using the component on a prefab (authoring)
// Assign the texture in the inspector on the TerrainMaterialProperties component,
// then during prefab conversion (if you extend conversion) you can read m_Texture.
[ComponentMenu("Tools/", new Type[] { typeof(TerraformingPrefab) })]
public class TerrainMaterialProperties : ComponentBase
{
public Texture m_Texture;
// Currently these do not add ECS component types, but you could override them
// to register required types for conversion.
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
// Example: to add a tag/component to the prefab conversion, you might
// components.Add(ComponentType.ReadWrite<SomeEcsComponent>());
}
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
// Example: add runtime ECS component types for the archetype
}
}