Matter 1.0.0
  • Getting Started
  • Authoring
  • Rendering
  • Integration
  • Samples
  • Reference
  • Support
Search Results for

    Browse the manual
    • Matter user guide
    • Getting Started
    • Requirements and compatibility
    • Authoring
    • Substance authoring
    • Rendering
    • Surface smoothing
    • Integration
    • Core concepts
    • Worlds, saving and loading
    • Physics integration
    • Web deployment
    • FishNet integration
    • Samples
    • Benchmarking
    • Reference
    • Runtime API
    • Rendering API
    • Editor API
    • Release notes
    • Support
    • Troubleshooting

    Runtime API

    Simulation, substances, saved worlds, and transport-neutral replication.

    Start with the integration guide for complete examples, or use the API index to find a type.

    ReactionRule

    public class MasterTech.Matter.Data.ReactionRule

    Authoring-time pair reaction stored with Unity's native serializer.

    Properties

    Member Signature Description
    Bidirectional bool Bidirectional { get; } Gets whether bidirectional.
    HeatDelta float HeatDelta { get; } Gets the heat delta.
    ProductA MasterTech.Matter.Data.SubstanceDefinition ProductA { get; } Gets the product a.
    ProductB MasterTech.Matter.Data.SubstanceDefinition ProductB { get; } Gets the product b.
    Rate float Rate { get; } Gets the rate.
    SubstanceA MasterTech.Matter.Data.SubstanceDefinition SubstanceA { get; } Gets the substance a.
    SubstanceB MasterTech.Matter.Data.SubstanceDefinition SubstanceB { get; } Gets the substance b.

    Constructors

    ReactionRule

    Overload 1

    Creates a new ReactionRule instance.

    Signature

    public ReactionRule()

    Overload 2

    Creates a new ReactionRule instance.

    Signature

    public ReactionRule(MasterTech.Matter.Data.SubstanceDefinition first, MasterTech.Matter.Data.SubstanceDefinition second, MasterTech.Matter.Data.SubstanceDefinition firstProduct, MasterTech.Matter.Data.SubstanceDefinition secondProduct, float reactionRate, float reactionHeatDelta, bool isBidirectional)

    Parameters

    Name Type Description
    first MasterTech.Matter.Data.SubstanceDefinition The first value.
    second MasterTech.Matter.Data.SubstanceDefinition The second value.
    firstProduct MasterTech.Matter.Data.SubstanceDefinition The first product value.
    secondProduct MasterTech.Matter.Data.SubstanceDefinition The second product value.
    reactionRate float The reaction rate value.
    reactionHeatDelta float The reaction heat delta value.
    isBidirectional bool Whether is bidirectional.

    Methods

    Configure

    Configure the supplied values.

    Signature

    public void Configure(MasterTech.Matter.Data.SubstanceDefinition first, MasterTech.Matter.Data.SubstanceDefinition second, MasterTech.Matter.Data.SubstanceDefinition firstProduct, MasterTech.Matter.Data.SubstanceDefinition secondProduct, float reactionRate, float reactionHeatDelta, bool isBidirectional)

    Parameters

    Name Type Description
    first MasterTech.Matter.Data.SubstanceDefinition The first value.
    second MasterTech.Matter.Data.SubstanceDefinition The second value.
    firstProduct MasterTech.Matter.Data.SubstanceDefinition The first product value.
    secondProduct MasterTech.Matter.Data.SubstanceDefinition The second product value.
    reactionRate float The reaction rate value.
    reactionHeatDelta float The reaction heat delta value.
    isBidirectional bool Whether is bidirectional.

    SubstanceBoundaryBlendSettings

    public class MasterTech.Matter.Data.SubstanceBoundaryBlendSettings

    Controls visual transitions between neighboring terrain materials. HardInterface keeps a sharp edge; the remaining controls shape the width, height response, and irregularity of a soft transition. These settings do not change the cells.

    Properties

    Member Signature Description
    BlendWidthCells float BlendWidthCells { get; set; } Visual material-transition width in reference cells.
    HardInterface bool HardInterface { get; set; } Preserves a sharp visual interface rather than a soft material blend.
    HeightContrast float HeightContrast { get; set; } Contrast applied to the boundary's height-based blend signal.
    HeightInfluence float HeightInfluence { get; set; } Contribution of authored texture height to material-boundary blending.
    OrganicIrregularity float OrganicIrregularity { get; set; } Visual variation that breaks up uniform material-transition edges.

    Constructors

    SubstanceBoundaryBlendSettings

    Creates a new SubstanceBoundaryBlendSettings instance.

    Signature

    public SubstanceBoundaryBlendSettings()

    SubstanceDatabase

    public class MasterTech.Matter.Data.SubstanceDatabase

    Ordered substance and reaction authoring asset. Its list positions define persistent material IDs.

    Usage: Author this asset through Tools > Matter > Substances. For a temporary runtime database, use ScriptableObject.CreateInstance<SubstanceDatabase>(). Dispose only a database whose lifetime your code owns, after its consumers stop using it.

    Properties

    Member Signature Description
    BakeRevision uint BakeRevision { get; } Revision incremented when simulation data is rebaked; consumers use it to refresh bindings.
    Count int Count { get; } Number of authored substance slots, including any invalid null entries awaiting repair.
    Reactions System.Collections.Generic.IReadOnlyList<MasterTech.Matter.Data.ReactionRule> Reactions { get; } Read-only view of authored reaction rules to validate and bake.
    RenderLibrary MasterTech.Matter.Data.SubstanceRenderLibrary RenderLibrary { get; } Separate baked presentation asset associated with this database.
    Substances System.Collections.Generic.IReadOnlyList<MasterTech.Matter.Data.SubstanceDefinition> Substances { get; } Read-only view of ordered definitions. Reordering changes saved and replicated material identities.

    Methods

    Bake

    Builds CPU records and uploads them to structured GPU buffers.

    Signature

    public void Bake()

    CollectRenderValidationErrors

    Collects presentation validation failures separately from physical and reaction validation.

    Signature

    public System.Collections.Generic.List<string> CollectRenderValidationErrors()

    Returns

    System.Collections.Generic.List<string>: An owned list of errors; empty when rendering inputs validate.

    CollectValidationErrors

    Collects authored substance and reaction errors without repairing or baking assets.

    Signature

    public System.Collections.Generic.List<string> CollectValidationErrors()

    Returns

    System.Collections.Generic.List<string>: An owned list of errors; empty when simulation inputs validate.

    Dispose

    Releases GPU resources; it does not delete the ScriptableObject or its authored definitions.

    Signature

    public void Dispose()

    GetDefinition

    Returns the definition at a material ID. Throws ArgumentOutOfRangeException when the ID is outside the ordered list.

    Signature

    public MasterTech.Matter.Data.SubstanceDefinition GetDefinition(ushort materialId)

    Parameters

    Name Type Description
    materialId ushort Stable positional ID in the target substance database.

    Returns

    MasterTech.Matter.Data.SubstanceDefinition: The definition in that slot; a null slot indicates invalid authored data.

    SetReactions

    Replaces authored reaction rules; validate and rebake before consuming them in simulation.

    Signature

    public void SetReactions(System.Collections.Generic.IEnumerable<MasterTech.Matter.Data.ReactionRule> rules)

    Parameters

    Name Type Description
    rules System.Collections.Generic.IEnumerable<MasterTech.Matter.Data.ReactionRule> Reaction rules whose substance references belong to this database.

    SetRenderLibrary

    Associates the generated render-only library with this stable substance ordering.

    Signature

    public void SetRenderLibrary(MasterTech.Matter.Data.SubstanceRenderLibrary library)

    Parameters

    Name Type Description
    library MasterTech.Matter.Data.SubstanceRenderLibrary Generated render-library asset corresponding to this database ordering.

    SetSubstances

    Replaces the authored ordering. Establish IDs before shipping; this does not remap existing saved cells.

    Signature

    public void SetSubstances(System.Collections.Generic.IEnumerable<MasterTech.Matter.Data.SubstanceDefinition> definitions)

    Parameters

    Name Type Description
    definitions System.Collections.Generic.IEnumerable<MasterTech.Matter.Data.SubstanceDefinition> Definitions in their permanent material-ID order.

    TryGetMaterialId

    Finds a definition in the current ordered list without changing the database.

    Signature

    public bool TryGetMaterialId(MasterTech.Matter.Data.SubstanceDefinition definition, ushort& materialId)

    Parameters

    Name Type Description
    definition MasterTech.Matter.Data.SubstanceDefinition Definition whose identity or configuration is being used.
    materialId ushort& Stable positional ID in the target substance database.

    Returns

    bool: True if the definition is present; materialId then contains its index.

    SubstanceDefinition

    public class MasterTech.Matter.Data.SubstanceDefinition

    Authored material behavior and appearance; its database assigns the stable positional ID.

    Usage: Create and edit definitions through Tools > Matter > Substances. Runtime authoring code can use ScriptableObject.CreateInstance<SubstanceDefinition>(); add the definition to the intended database and bake before using its ID.

    Properties

    Member Signature Description
    BaseColor UnityEngine.Color BaseColor { get; } Base color of the substance. Cell temperature applies the Temperature Color Gradient on top of this authored appearance.
    BoiledResult MasterTech.Matter.Data.SubstanceDefinition BoiledResult { get; } Substance produced when this substance reaches or exceeds Boil Point. Leave empty for no boil transition.
    BoilPoint float BoilPoint { get; } Boil or transition point in degrees Celsius.
    CollideWithTerrain bool CollideWithTerrain { get; } Prevents this substance from moving through Matter terrain occupancy when terrain collision is evaluated.
    ColorGradient UnityEngine.Gradient ColorGradient { get; } Maps encoded cell temperature from 0 °C at the left edge to 255 °C at the right edge. The runtime blends from Base Color toward the gradient's right-edge color.
    Compressibility float Compressibility { get; } Allowed fill-pressure imbalance before liquid equalization. Higher values tolerate a larger imbalance.
    CondensedResult MasterTech.Matter.Data.SubstanceDefinition CondensedResult { get; } Substance produced when this substance cools after boiling. Leave empty when condensation is not applicable.
    Density float Density { get; } Relative mass density. Denser substances settle below lighter substances when their phases can exchange positions.
    Dispersion float Dispersion { get; } How strongly a gas spreads toward neighboring cells. Zero stays ballistic; one uses the full dispersion rate.
    DisplayName string DisplayName { get; } Name shown in Matter authoring tools and substance lists.
    DynamicObjectCollisionLayers UnityEngine.LayerMask DynamicObjectCollisionLayers { get; } Unity object layers that block this substance in the optional dynamic-object coupling. Displacement layers always imply collision even when they are not also selected here.
    DynamicObjectDisplacementLayers UnityEngine.LayerMask DynamicObjectDisplacementLayers { get; } Unity object layers that may conservatively push this substance out of newly occupied cells when displacement is enabled.
    DynamicObjectImpactWaveLayers UnityEngine.LayerMask DynamicObjectImpactWaveLayers { get; } Unity object layers that may create entry and underwater waves when this substance is a liquid.
    Flammable bool Flammable { get; } Allows the substance to enter the burning state when ignition conditions are met.
    FlowRate float FlowRate { get; } Maximum mobility used by liquid and powder flow. Zero does not flow; one uses the full available transfer rate.
    FreezePoint float FreezePoint { get; } Freeze point in degrees Celsius.
    FrozenResult MasterTech.Matter.Data.SubstanceDefinition FrozenResult { get; } Substance produced when this substance reaches or falls below Freeze Point. Leave empty for no freeze transition.
    Id ushort Id { get; } Last assigned database index; use the owning database to resolve membership rather than editing this value.
    Phase MasterTech.Matter.Data.SubstancePhase Phase { get; } Simulation category that determines how the substance moves and which renderer path displays it.
    Rendering MasterTech.Matter.Data.SubstanceRenderingSettings Rendering { get; } Texture, mapping, blending, transparency, and lighting settings baked into the Substance Render Library.
    SelfTemperatureStrength float SelfTemperatureStrength { get; } Maximum self heating/cooling rate in Celsius degrees per simulated second; zero disables it.
    StandardTemperature byte StandardTemperature { get; } Default paint temperature in degrees Celsius.
    SurroundingTemperatureStrength float SurroundingTemperatureStrength { get; } Rate contributed to each occupied edge neighbor toward the target, in Celsius degrees per simulated second.
    TargetTemperature int TargetTemperature { get; } Persistent target in whole Celsius degrees, from zero through 255.
    Viscosity float Viscosity { get; } Resistance to movement. Zero is freely mobile; one prevents the normal flow contribution.

    Methods

    Configure

    Runtime/editor construction API used by importers and tests.

    Signature

    public void Configure(string name, MasterTech.Matter.Data.SubstancePhase substancePhase, float substanceDensity, float substanceViscosity, float substanceFlowRate, float substanceDispersion, float substanceCompressibility, UnityEngine.Color substanceColor, bool isFlammable, bool collidesWithTerrain, byte standardTemperatureCelsius)

    Parameters

    Name Type Description
    name string Asset name sought by the editor lookup.
    substancePhase MasterTech.Matter.Data.SubstancePhase Movement/rendering phase of the authored substance.
    substanceDensity float Nonnegative relative mass density.
    substanceViscosity float Resistance to normal flow, in [0, 1].
    substanceFlowRate float Normal transfer mobility factor in [0, 1].
    substanceDispersion float Gas-spreading factor in [0, 1].
    substanceCompressibility float Allowed fill-pressure imbalance factor.
    substanceColor UnityEngine.Color Base authored cell color.
    isFlammable bool Whether the authored substance can participate in burning behavior.
    collidesWithTerrain bool Whether this substance participates in authored terrain-collision classification.
    standardTemperatureCelsius byte Default paint temperature in the representable Celsius range.

    ConfigureDynamicObjectInteraction

    Sets the object layers that participate in collision, displacement, and impact waves. These effects require an integration that enables the corresponding coupling features.

    Signature

    public void ConfigureDynamicObjectInteraction(UnityEngine.LayerMask collisionLayers, UnityEngine.LayerMask displacementLayers, UnityEngine.LayerMask impactWaveLayers)

    Parameters

    Name Type Description
    collisionLayers UnityEngine.LayerMask Unity object layers whose dynamic silhouettes can block this material when coupling is enabled.
    displacementLayers UnityEngine.LayerMask Object layers permitted to displace this material when displacement coupling is enabled.
    impactWaveLayers UnityEngine.LayerMask Object layers permitted to drive this material's impact waves when that coupling is enabled.

    ConfigurePhaseChanges

    Assigns freeze/boil thresholds and product definitions. Validate and rebake the owning database afterward.

    Signature

    public void ConfigurePhaseChanges(float freezingTemperature, float boilingTemperature, MasterTech.Matter.Data.SubstanceDefinition frozen, MasterTech.Matter.Data.SubstanceDefinition boiled, MasterTech.Matter.Data.SubstanceDefinition condensed)

    Parameters

    Name Type Description
    freezingTemperature float Freeze threshold in degrees Celsius.
    boilingTemperature float Boil threshold in degrees Celsius, not below the freeze threshold.
    frozen MasterTech.Matter.Data.SubstanceDefinition Optional product below the freeze threshold.
    boiled MasterTech.Matter.Data.SubstanceDefinition Optional product above the boil threshold.
    condensed MasterTech.Matter.Data.SubstanceDefinition Optional condensation product; referenced products must belong to the same database.

    ConfigureRendering

    Assigns the substance's appearance settings. Rebake rendering data to update the visible surface.

    Signature

    public void ConfigureRendering(MasterTech.Matter.Data.SubstanceRenderingSettings settings)

    Parameters

    Name Type Description
    settings MasterTech.Matter.Data.SubstanceRenderingSettings Value-type settings to compare or apply; caller retains its copy.

    ConfigureTemperatureControl

    Sets active thermal behavior. Validate and rebake the owning database after changing it.

    Signature

    public void ConfigureTemperatureControl(int targetCelsius, float selfDegreesPerSecond, float surroundingDegreesPerSecond)

    Parameters

    Name Type Description
    targetCelsius int Target temperature from zero through 255 Celsius degrees.
    selfDegreesPerSecond float Self rate in [0, 65535]; zero disables this contribution.
    surroundingDegreesPerSecond float Rate for each edge neighbor in [0, 65535]; zero disables this contribution.

    SetColorGradient

    Replaces the temperature-color gradient, using a valid fallback when none is supplied.

    Signature

    public void SetColorGradient(UnityEngine.Gradient gradient)

    Parameters

    Name Type Description
    gradient UnityEngine.Gradient Authored mapping from encoded cell temperature to color.

    SubstanceGlossMapChannel

    public enum MasterTech.Matter.Data.SubstanceGlossMapChannel

    Defines the available substance gloss map channel values.

    Fields

    Member Signature Description
    Alpha public static MasterTech.Matter.Data.SubstanceGlossMapChannel Alpha Provides the alpha value.
    Red public static MasterTech.Matter.Data.SubstanceGlossMapChannel Red Provides the red value.

    SubstanceGlossMapEncoding

    public enum MasterTech.Matter.Data.SubstanceGlossMapEncoding

    Defines the available substance gloss map encoding values.

    Fields

    Member Signature Description
    Roughness public static MasterTech.Matter.Data.SubstanceGlossMapEncoding Roughness Provides the roughness value.
    Smoothness public static MasterTech.Matter.Data.SubstanceGlossMapEncoding Smoothness Provides the smoothness value.

    SubstanceHeightBlendSettings

    public class MasterTech.Matter.Data.SubstanceHeightBlendSettings

    Controls height-aware blending within one substance's texture sets.

    Properties

    Member Signature Description
    DetailBias float DetailBias { get; set; } Bias shifting the detail-height blend signal relative to base height.
    DetailContrast float DetailContrast { get; set; } Contrast applied to the detail-height blend signal.
    DetailInfluence float DetailInfluence { get; set; } Contribution of detail-map height to base/detail blending.
    VariantBias float VariantBias { get; set; } Bias shifting which height samples dominate variant transitions.
    VariantContrast float VariantContrast { get; set; } Contrast applied to heights used when blending variants.
    VariantInfluence float VariantInfluence { get; set; } Contribution of authored height to texture-variant transitions.

    Constructors

    SubstanceHeightBlendSettings

    Creates a new SubstanceHeightBlendSettings instance.

    Signature

    public SubstanceHeightBlendSettings()

    SubstancePhase

    public enum MasterTech.Matter.Data.SubstancePhase

    Defines the available substance phase values.

    Fields

    Member Signature Description
    Gas public static MasterTech.Matter.Data.SubstancePhase Gas Provides the gas value.
    Liquid public static MasterTech.Matter.Data.SubstancePhase Liquid Provides the liquid value.
    Powder public static MasterTech.Matter.Data.SubstancePhase Powder Provides the powder value.
    Solid public static MasterTech.Matter.Data.SubstancePhase Solid Provides the solid value.
    Static public static MasterTech.Matter.Data.SubstancePhase Static Provides the static value.

    SubstanceRenderLibrary

    public class MasterTech.Matter.Data.SubstanceRenderLibrary

    Baked material presentation and texture-tier ownership. Author definitions and rebake rather than editing generated buffers.

    Usage: Use the library produced by Bake Rendering Data. Edit the source substance definitions rather than the generated library. Dispose only a library owned by your integration, after releasing its consumers.

    Properties

    Member Signature Description
    ActiveTextureResolution int ActiveTextureResolution { get; } Most recently resolved active tier resolution, falling back to the base bake resolution.
    BakeRevision uint BakeRevision { get; } Revision used to detect replacement of baked presentation data.
    HasNativeQualityTiers bool HasNativeQualityTiers { get; } True when project-generated texture tiers are addressable through the cache path prefix.
    SubstanceCount int SubstanceCount { get; } Number of per-substance render records in the current bake.
    TextureResolution int TextureResolution { get; } Authored base texture-array resolution recorded by the bake.
    TextureSetCount int TextureSetCount { get; } Number of baked texture-set records referenced by the substance records.

    Methods

    BindDisabled

    Writes disabled material-library bindings into a property block for an untextured fallback.

    Signature

    public static void BindDisabled(UnityEngine.MaterialPropertyBlock block)

    Parameters

    Name Type Description
    block UnityEngine.MaterialPropertyBlock Caller-owned reusable material property block; its consumer must release a retained binding when finished.

    CollectValidationErrors

    Collects missing-array, record and count problems without baking or changing source assets.

    Signature

    public System.Collections.Generic.List<string> CollectValidationErrors(int expectedSubstanceCount)

    Parameters

    Name Type Description
    expectedSubstanceCount int Required record count, or -1 to skip that external count check.

    Returns

    System.Collections.Generic.List<string>: An owned list of render-library failures; empty when validation succeeds.

    Dispose

    Releases this library's runtime resources and retained consumer bindings without deleting the asset.

    Signature

    public void Dispose()

    ReleaseBinding

    Releases the texture-tier ownership associated with a property block after its renderer stops using it. Other bindings remain valid. Disposing the library releases all remaining bindings.

    Signature

    public void ReleaseBinding(UnityEngine.MaterialPropertyBlock block)

    Parameters

    Name Type Description
    block UnityEngine.MaterialPropertyBlock The previously bound property block.

    TryBind

    Binds presentation data and retains the selected texture tier for this property block. Reuse the block while rendering and call MasterTech.Matter.Data.SubstanceRenderLibrary.ReleaseBinding(UnityEngine.MaterialPropertyBlock) when its consumer stops using it.

    Signature

    public bool TryBind(UnityEngine.MaterialPropertyBlock block, int expectedSubstanceCount, int textureQuality)

    Parameters

    Name Type Description
    block UnityEngine.MaterialPropertyBlock The reusable property block owned by the consumer.
    expectedSubstanceCount int The simulation's substance count.
    textureQuality int Texture tier: 0 = baked base payload, 1 = 1024, 2 = 512, 3 = 256, 4 = 4096, 5 = 8192, 6 = 128 pixels. The renderer applies its requested resolution through mip selection when falling back to the base payload.

    Returns

    bool: Whether the library was valid and its resources were bound.

    SubstanceRenderingSettings

    public class MasterTech.Matter.Data.SubstanceRenderingSettings

    Rendering-only authoring data owned by a substance definition. It is intentionally separate from MasterTech.Matter.Data.SubstanceGpuData.

    Properties

    Member Signature Description
    BoundaryBlending MasterTech.Matter.Data.SubstanceBoundaryBlendSettings BoundaryBlending { get; set; } Visual transitions between this material and its neighbors.
    HeightBlending MasterTech.Matter.Data.SubstanceHeightBlendSettings HeightBlending { get; set; } Height-based variant and base/detail blending settings.
    Lighting MasterTech.Matter.Data.SubstanceStylizedLightingSettings Lighting { get; set; } Per-substance light response, relief, highlights and emission settings.
    Mapping MasterTech.Matter.Data.SubstanceTextureMappingSettings Mapping { get; set; } World-space placement settings shared by the substance's aligned maps.
    TextureColorInfluence float TextureColorInfluence { get; set; } Blend between authored substance color and sampled albedo color.
    TextureSets System.Collections.Generic.IReadOnlyList<MasterTech.Matter.Data.SubstanceTextureSet> TextureSets { get; } Read-only view of the authored weighted base/detail texture sets.
    Transparency MasterTech.Matter.Data.SubstanceTransparencySettings Transparency { get; set; } Per-substance surface model and optical settings.
    Variation MasterTech.Matter.Data.SubstanceTextureVariationSettings Variation { get; set; } Deterministic texture-set region selection settings.

    Fields

    Member Signature Description
    MaxTextureSetCount public static int MaxTextureSetCount Maximum of eight texture sets per substance supported by the baked representation.

    Constructors

    SubstanceRenderingSettings

    Creates a new SubstanceRenderingSettings instance.

    Signature

    public SubstanceRenderingSettings()

    Methods

    AddTextureSet

    Adds an authored texture set; validation enforces the supported count and map requirements.

    Signature

    public void AddTextureSet(MasterTech.Matter.Data.SubstanceTextureSet set)

    Parameters

    Name Type Description
    set MasterTech.Matter.Data.SubstanceTextureSet Texture-set definition to add.

    ClearTextureSets

    Removes authored texture-set references; existing baked output must be regenerated.

    Signature

    public void ClearTextureSets()

    SetTextureSets

    Replaces the authored texture-set collection. Validate and bake rendering data before use.

    Signature

    public void SetTextureSets(System.Collections.Generic.IEnumerable<MasterTech.Matter.Data.SubstanceTextureSet> sets)

    Parameters

    Name Type Description
    sets System.Collections.Generic.IEnumerable<MasterTech.Matter.Data.SubstanceTextureSet> Authored texture sets in their intended order.

    SubstanceStylizedLightingSettings

    public class MasterTech.Matter.Data.SubstanceStylizedLightingSettings

    Per-substance lighting, elevation, highlights, tint and emission baked into presentation records.

    Properties

    Member Signature Description
    AmbientStrength float AmbientStrength { get; set; } Multiplier for ambient illumination on this substance.
    CavityStrength float CavityStrength { get; set; } Darkening of fine surface recesses for this material.
    DiffuseBandCount int DiffuseBandCount { get; set; } Number of discrete diffuse bands used by stylized lighting.
    DiffuseBandSoftness float DiffuseBandSoftness { get; set; } Softens transitions between the substance's diffuse lighting bands.
    DirectLightStrength float DirectLightStrength { get; set; } Multiplier for direct illumination on this substance.
    EdgeTint UnityEngine.Color EdgeTint { get; set; } Tint applied along the material's visible edge.
    EdgeTintStrength float EdgeTintStrength { get; set; } Blend amount for the material edge tint.
    ElevationEdgeStrength float ElevationEdgeStrength { get; set; } Strength of lighting at elevation transitions between materials.
    EmissionColor UnityEngine.Color EmissionColor { get; set; } Authored emission color, independent of thermal simulation changes.
    EmissionStrength float EmissionStrength { get; set; } Multiplier for the material's non-temperature emission.
    GlossMapInfluence float GlossMapInfluence { get; set; } Contribution of the authored gloss map to the specular response.
    HeightNormalStrength float HeightNormalStrength { get; set; } Strength of shading normals derived from authored height maps.
    NormalMapStrength float NormalMapStrength { get; set; } Influence of authored tangent-space normal maps on lighting.
    RimColor UnityEngine.Color RimColor { get; set; } Color of the material's edge/rim contribution.
    RimPower float RimPower { get; set; } Controls the concentration of the rim response.
    RimStrength float RimStrength { get; set; } Intensity of rim lighting on this material.
    ShadowStrength float ShadowStrength { get; set; } Amount of shadow attenuation applied to this material's lighting.
    SpecularIntensity float SpecularIntensity { get; set; } Strength of specular highlights on this substance.
    SpecularSharpness float SpecularSharpness { get; set; } Sharpness of the specular response; larger values concentrate highlights.
    SurfaceElevation float SurfaceElevation { get; set; } Render-only elevation bias affecting material relief; does not move cells or colliders.
    TemperatureEmissionColor UnityEngine.Color TemperatureEmissionColor { get; set; } Emission color reached through the encoded cell-temperature response.
    TemperatureEmissionStrength float TemperatureEmissionStrength { get; set; } Multiplier for temperature-driven visual emission.
    TopSurfaceTint UnityEngine.Color TopSurfaceTint { get; set; } Tint applied to the substance's visual top cap.
    TopSurfaceTintStrength float TopSurfaceTintStrength { get; set; } Blend amount for the top-surface tint.

    Constructors

    SubstanceStylizedLightingSettings

    Creates a new SubstanceStylizedLightingSettings instance.

    Signature

    public SubstanceStylizedLightingSettings()

    SubstanceSurfaceModel

    public enum MasterTech.Matter.Data.SubstanceSurfaceModel

    Defines the available substance surface model values.

    Fields

    Member Signature Description
    Cutout public static MasterTech.Matter.Data.SubstanceSurfaceModel Cutout Provides the cutout value.
    Gas public static MasterTech.Matter.Data.SubstanceSurfaceModel Gas Provides the gas value.
    Liquid public static MasterTech.Matter.Data.SubstanceSurfaceModel Liquid Provides the liquid value.
    Opaque public static MasterTech.Matter.Data.SubstanceSurfaceModel Opaque Provides the opaque value.
    Translucent public static MasterTech.Matter.Data.SubstanceSurfaceModel Translucent Provides the translucent value.

    SubstanceTextureMappingMode

    public enum MasterTech.Matter.Data.SubstanceTextureMappingMode

    Defines the available substance texture mapping mode values.

    Fields

    Member Signature Description
    Repeat public static MasterTech.Matter.Data.SubstanceTextureMappingMode Repeat Provides the repeat value.
    StochasticPatch public static MasterTech.Matter.Data.SubstanceTextureMappingMode StochasticPatch Provides the stochastic patch value.

    SubstanceTextureMappingSettings

    public class MasterTech.Matter.Data.SubstanceTextureMappingSettings

    World-space texture placement shared by a substance's aligned PBR maps.

    Properties

    Member Signature Description
    Mode MasterTech.Matter.Data.SubstanceTextureMappingMode Mode { get; set; } Selects repeating or stochastic-patch mapping; world-clamp behavior is an independent axis-clamp option.
    RandomizePatchMirror bool RandomizePatchMirror { get; set; } Allows deterministic mirroring within stochastic patches.
    RandomizePatchRotation bool RandomizePatchRotation { get; set; } Allows deterministic patch rotations to reduce repeated patterns.
    RotationDegrees float RotationDegrees { get; set; } Rotation of the mapped texture axes in degrees.
    StochasticBlendWidth float StochasticBlendWidth { get; set; } Normalized transition width used to blend neighboring stochastic patches.
    StochasticPatchWorldSize float StochasticPatchWorldSize { get; set; } World-space size of randomized texture patches.
    WorldUnitsPerTile UnityEngine.Vector2 WorldUnitsPerTile { get; set; } World-space width and height of one texture repeat; positive values are required for meaningful mapping.

    Constructors

    SubstanceTextureMappingSettings

    Creates a new SubstanceTextureMappingSettings instance.

    Signature

    public SubstanceTextureMappingSettings()

    SubstanceTextureMaps

    public class MasterTech.Matter.Data.SubstanceTextureMaps

    Source maps for one texture layer. Set the authoring maps, then use Bake Rendering Data to update the render library.

    Properties

    Member Signature Description
    AlbedoOpacity UnityEngine.Texture2D AlbedoOpacity { get; set; } Gets or sets the albedo opacity.
    AmbientOcclusion UnityEngine.Texture2D AmbientOcclusion { get; set; } Gets or sets the ambient occlusion.
    Emission UnityEngine.Texture2D Emission { get; set; } Gets or sets the emission.
    Gloss UnityEngine.Texture2D Gloss { get; set; } Gets or sets the gloss.
    GlossChannel MasterTech.Matter.Data.SubstanceGlossMapChannel GlossChannel { get; set; } Gets or sets the gloss channel.
    GlossEncoding MasterTech.Matter.Data.SubstanceGlossMapEncoding GlossEncoding { get; set; } Gets or sets the gloss encoding.
    HasAnyTexture bool HasAnyTexture { get; } Gets whether this value has any texture.
    Height UnityEngine.Texture2D Height { get; set; } Gets or sets the height.
    HeightMidpoint float HeightMidpoint { get; set; } Gets or sets the height midpoint.
    InvertNormalGreen bool InvertNormalGreen { get; set; } Gets or sets whether invert normal green.
    Normal UnityEngine.Texture2D Normal { get; set; } Gets or sets the normal.

    Constructors

    SubstanceTextureMaps

    Overload 1

    Creates a new SubstanceTextureMaps instance.

    Signature

    public SubstanceTextureMaps()

    Overload 2

    Creates a new SubstanceTextureMaps instance.

    Signature

    public SubstanceTextureMaps(UnityEngine.Texture2D albedoOpacity, UnityEngine.Texture2D height, UnityEngine.Texture2D normal, UnityEngine.Texture2D gloss, UnityEngine.Texture2D ambientOcclusion, UnityEngine.Texture2D emission)

    Parameters

    Name Type Description
    albedoOpacity UnityEngine.Texture2D The albedo opacity value.
    height UnityEngine.Texture2D The height value.
    normal UnityEngine.Texture2D The normal value.
    gloss UnityEngine.Texture2D The gloss value.
    ambientOcclusion UnityEngine.Texture2D The ambient occlusion value.
    emission UnityEngine.Texture2D The emission value.

    SubstanceTextureSet

    public class MasterTech.Matter.Data.SubstanceTextureSet

    One weighted visual variant for a substance. All maps in a set share the same deterministic selection and UV transform so their features stay aligned.

    Properties

    Member Signature Description
    BaseMaps MasterTech.Matter.Data.SubstanceTextureMaps BaseMaps { get; set; } Gets or sets the base maps.
    DetailColorStrength float DetailColorStrength { get; set; } Gets or sets the detail color strength.
    DetailHeightStrength float DetailHeightStrength { get; set; } Gets or sets the detail height strength.
    DetailMaps MasterTech.Matter.Data.SubstanceTextureMaps DetailMaps { get; set; } Gets or sets the detail maps.
    DetailNormalStrength float DetailNormalStrength { get; set; } Gets or sets the detail normal strength.
    DetailScaleMultiplier float DetailScaleMultiplier { get; set; } Gets or sets the detail scale multiplier.
    DisplayName string DisplayName { get; set; } Gets or sets the display name.
    HeightAmplitude float HeightAmplitude { get; set; } Gets or sets the height amplitude.
    HeightBias float HeightBias { get; set; } Gets or sets the height bias.
    NormalStrength float NormalStrength { get; set; } Gets or sets the normal strength.
    RotationDegrees float RotationDegrees { get; set; } Gets or sets the rotation degrees.
    ScaleMultiplier UnityEngine.Vector2 ScaleMultiplier { get; set; } Gets or sets the scale multiplier.
    SelectionWeight float SelectionWeight { get; set; } Gets or sets the selection weight.
    Tint UnityEngine.Color Tint { get; set; } Gets or sets the tint.

    Constructors

    SubstanceTextureSet

    Overload 1

    Creates a new SubstanceTextureSet instance.

    Signature

    public SubstanceTextureSet()

    Overload 2

    Creates a new SubstanceTextureSet instance.

    Signature

    public SubstanceTextureSet(string displayName, MasterTech.Matter.Data.SubstanceTextureMaps baseMaps, float selectionWeight)

    Parameters

    Name Type Description
    displayName string The display name value.
    baseMaps MasterTech.Matter.Data.SubstanceTextureMaps The base maps value.
    selectionWeight float The selection weight value.

    SubstanceTextureVariationSettings

    public class MasterTech.Matter.Data.SubstanceTextureVariationSettings

    Deterministic region-based selection of a substance's weighted texture sets.

    Properties

    Member Signature Description
    RegionWorldSize float RegionWorldSize { get; set; } World-space size of texture-variant regions.
    Seed int Seed { get; set; } Seed controlling stable region selection without changing simulation randomness.
    TransitionWidth float TransitionWidth { get; set; } Width of the visual transition between neighboring variant regions.

    Constructors

    SubstanceTextureVariationSettings

    Creates a new SubstanceTextureVariationSettings instance.

    Signature

    public SubstanceTextureVariationSettings()

    SubstanceTransparencySettings

    public class MasterTech.Matter.Data.SubstanceTransparencySettings

    Per-substance optical presentation; these values do not change mass or fluid transport.

    Properties

    Member Signature Description
    AbsorptionColor UnityEngine.Color AbsorptionColor { get; set; } Color used to tint light through the liquid's estimated optical thickness.
    AbsorptionStrength float AbsorptionStrength { get; set; } Strength of absorption through the visual liquid thickness estimate.
    CutoutThreshold float CutoutThreshold { get; set; } Alpha threshold used by the cutout surface model.
    Opacity float Opacity { get; set; } Base optical opacity of the substance, separate from encoded cell fill.
    RefractionStrength float RefractionStrength { get; set; } Amount of visual background distortion for transparent matter.
    SoftEdgeStrength float SoftEdgeStrength { get; set; } Softens the transparent material's visible boundary.
    SurfaceHighlightStrength float SurfaceHighlightStrength { get; set; } Strength of the transparent surface-edge highlight.
    SurfaceModel MasterTech.Matter.Data.SubstanceSurfaceModel SurfaceModel { get; set; } Chooses opaque, cutout, translucent, liquid or gas shading; independent of the simulation phase.

    Constructors

    SubstanceTransparencySettings

    Creates a new SubstanceTransparencySettings instance.

    Signature

    public SubstanceTransparencySettings()

    MatterRuntimeCapabilities

    public static class MasterTech.Matter.MatterRuntimeCapabilities

    Runtime graphics capabilities that affect Matter's simulation and presentation paths.

    Properties

    Member Signature Description
    GraphicsApiLabel string GraphicsApiLabel { get; } Gets the graphics API label.
    GraphicsDeviceType UnityEngine.Rendering.GraphicsDeviceType GraphicsDeviceType { get; } Gets the graphics device type.
    IsWebGpu bool IsWebGpu { get; } Gets whether this value is web GPU.
    RequiresAsyncGpuReadback bool RequiresAsyncGpuReadback { get; } WebGPU deliberately exposes GPU data through asynchronous readback. Synchronous ComputeBuffer.GetData calls are not supported.
    SupportsGpuSimulation bool SupportsGpuSimulation { get; } Gets whether this value supports GPU simulation.

    ChunkStreamCounters

    public struct MasterTech.Matter.Replication.ChunkStreamCounters

    Represents chunk stream counters data.

    Fields

    Member Signature Description
    BytesSent public ulong BytesSent Stores the bytes sent value.
    DeltaSnapshotsSent public ulong DeltaSnapshotsSent Stores the delta snapshots sent value.
    FullSnapshotsSent public ulong FullSnapshotsSent Stores the full snapshots sent value.
    SendsDeferredByBudget public ulong SendsDeferredByBudget Stores the sends deferred by budget value.
    SnapshotsAcknowledged public ulong SnapshotsAcknowledged Stores the snapshots acknowledged value.
    SnapshotsPublished public ulong SnapshotsPublished Stores the snapshots published value.
    SnapshotsRetried public ulong SnapshotsRetried Stores the snapshots retried value.
    SnapshotsSent public ulong SnapshotsSent Stores the snapshots sent value.
    SnapshotsSuperseded public ulong SnapshotsSuperseded Stores the snapshots superseded value.

    IMatterReplicationAdapter

    public interface MasterTech.Matter.Replication.IMatterReplicationAdapter

    Transport-neutral surface used by gameplay code that can operate either locally or through an optional networking integration.

    Properties

    Member Signature Description
    Diagnostics MasterTech.Matter.Replication.MatterReplicationDiagnostics Diagnostics { get; } Snapshot of stream, rejected-edit and readback diagnostics supplied by the adapter.
    IsClientReady bool IsClientReady { get; } Whether client prediction/replication is currently ready.
    IsServerReady bool IsServerReady { get; } Whether the adapter can currently accept authoritative server work.
    Simulation MasterTech.Matter.Simulation.MatterSimManager Simulation { get; } Simulation controlled by this transport-specific adapter, or null before it is configured.

    Methods

    SubmitPredictedEdit

    Submits a client prediction request through the adapter's validation and transport policy.

    Signature

    public abstract bool SubmitPredictedEdit(MasterTech.Matter.Simulation.EditCommand command)

    Parameters

    Name Type Description
    command MasterTech.Matter.Simulation.EditCommand Edit command in the adapter's simulation coordinates, subject to authority and validation policy.

    Returns

    bool: True when the adapter accepts the prediction request; false when unavailable or rejected.

    TrySubmitAuthoritativeEdit

    Attempts to enqueue an authoritative server edit through the adapter.

    Signature

    public abstract bool TrySubmitAuthoritativeEdit(MasterTech.Matter.Simulation.EditCommand command)

    Parameters

    Name Type Description
    command MasterTech.Matter.Simulation.EditCommand Edit command in the adapter's simulation coordinates, subject to authority and validation policy.

    Returns

    bool: True when the authoritative edit is accepted by the adapter.

    IMatterWorldTransferAdapter

    public interface MasterTech.Matter.Replication.IMatterWorldTransferAdapter

    Optional transport surface for loading one serialized Matter world on the authoritative peer and transferring the exact save to connected clients. Core Matter defines the contract but contains no transport implementation.

    Properties

    Member Signature Description
    CanLoadAndBroadcastWorld bool CanLoadAndBroadcastWorld { get; } Whether this adapter currently has the authority and readiness to replace and broadcast a world.

    Methods

    LoadAndBroadcastWorldAsync

    Requests a saved-world replacement and broadcast through the transport adapter's authority policy.

    Signature

    public abstract System.Threading.Tasks.Task<MasterTech.Matter.Replication.MatterWorldTransferResult> LoadAndBroadcastWorldAsync(byte[] serializedWorld, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    serializedWorld byte[] Complete checksummed .matterworld document bytes.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task<MasterTech.Matter.Replication.MatterWorldTransferResult>: A task yielding the transport's transfer result, including failure information.

    MatterReplicationDiagnostics

    public struct MasterTech.Matter.Replication.MatterReplicationDiagnostics

    Immutable snapshot of transport stream counters and simulation exchange failures; counters are diagnostic, not an acknowledgement of delivery.

    Properties

    Member Signature Description
    ReadbackErrors ulong ReadbackErrors { get; } Number of cell-state readback failures recorded by the adapter.
    RejectedEdits ulong RejectedEdits { get; } Number of edit submissions rejected by the adapter or simulation.
    StreamCounters MasterTech.Matter.Replication.ChunkStreamCounters StreamCounters { get; } Transport stream statistics captured when this diagnostic value was created.

    Constructors

    MatterReplicationDiagnostics

    Creates a diagnostic snapshot from the current stream counters and cumulative exchange failures.

    Signature

    public MatterReplicationDiagnostics(MasterTech.Matter.Replication.ChunkStreamCounters streamCounters, ulong readbackErrors, ulong rejectedEdits)

    Parameters

    Name Type Description
    streamCounters MasterTech.Matter.Replication.ChunkStreamCounters Transport stream counters to include in this snapshot.
    readbackErrors ulong Cumulative cell-state readback failure count.
    rejectedEdits ulong Cumulative rejected edit count.

    MatterWorldTransferResult

    public struct MasterTech.Matter.Replication.MatterWorldTransferResult

    Outcome of a serialized world transfer, including payload size and recipient counts; transport success does not guarantee that remote application code has applied the world.

    Properties

    Member Signature Description
    Error string Error { get; } Failure explanation, or an empty string when no explanation was provided.
    FailedClientCount int FailedClientCount { get; } Number of targeted clients whose transfer failed.
    SerializedBytes int SerializedBytes { get; } Serialized world payload size in bytes, excluding transport framing.
    Succeeded bool Succeeded { get; } Whether the operation reported success for its intended recipients.
    TargetClientCount int TargetClientCount { get; } Number of clients targeted by the transfer.

    Constructors

    MatterWorldTransferResult

    Creates a world-transfer outcome, normalizing a null error message to an empty string.

    Signature

    public MatterWorldTransferResult(bool succeeded, int serializedBytes, int targetClientCount, int failedClientCount, string error)

    Parameters

    Name Type Description
    succeeded bool Whether this transfer completed successfully.
    serializedBytes int Size of the serialized world payload in bytes.
    targetClientCount int Number of intended recipient clients.
    failedClientCount int Number of recipient transfers that failed.
    error string Human-readable failure description; null is normalized to an empty string.

    Methods

    Failure

    Creates a failed transfer result with recipient counts and an explanation.

    Signature

    public static MasterTech.Matter.Replication.MatterWorldTransferResult Failure(int serializedBytes, int targetClientCount, int failedClientCount, string error)

    Parameters

    Name Type Description
    serializedBytes int Size of the serialized world payload in bytes.
    targetClientCount int Number of intended recipient clients.
    failedClientCount int Number of recipient transfers that failed.
    error string Human-readable failure description; null is normalized to an empty string.

    Returns

    MasterTech.Matter.Replication.MatterWorldTransferResult: A failed transfer result carrying the supplied counts and error.

    Success

    Creates a successful transfer result with zero failed clients.

    Signature

    public static MasterTech.Matter.Replication.MatterWorldTransferResult Success(int serializedBytes, int targetClientCount)

    Parameters

    Name Type Description
    serializedBytes int Size of the serialized world payload in bytes.
    targetClientCount int Number of intended recipient clients.

    Returns

    MasterTech.Matter.Replication.MatterWorldTransferResult: A successful transfer result with an empty error message.

    MatterWorldAsset

    public class MasterTech.Matter.Serialization.MatterWorldAsset

    Typed Unity representation of an imported .matterworld document. The source bytes remain authoritative and are preserved exactly.

    Usage: Save a .matterworld document under Assets and use the imported asset. See loading in your own scene for initialization and asynchronous application.

    Properties

    Member Signature Description
    CellCount int CellCount { get; } Checked number of saved grid cells.
    Encoding MasterTech.Matter.Serialization.MatterWorldEncoding Encoding { get; } Payload encoding used by the imported source document.
    FormatVersion ushort FormatVersion { get; } Format version read from the imported document, not the package version.
    Metadata MasterTech.Matter.Serialization.MatterWorldMetadata Metadata { get; } Saved descriptive/application metadata; does not include scene GameObjects.
    SerializedByteSize int SerializedByteSize { get; } Length of the exact imported document in bytes.
    Settings MasterTech.Matter.Serialization.MatterWorldSettings Settings { get; } Saved layout, tick, solver configuration, mapping and schema metadata.
    SubstanceCount int SubstanceCount { get; } Number of substances recorded in the saved ordered schema.
    SubstanceSchemaHash ulong SubstanceSchemaHash { get; } Hash of the saved ordered substance schema used during compatibility validation.

    Methods

    CopySerializedBytes

    Returns a caller-owned copy of the exact source document.

    Signature

    public byte[] CopySerializedBytes()

    Returns

    byte[]: A caller-owned copy of the original document bytes.

    Deserialize

    Deserializes a complete immutable copy of this world.

    Signature

    public MasterTech.Matter.Serialization.MatterWorldSave Deserialize()

    Returns

    MasterTech.Matter.Serialization.MatterWorldSave: An immutable world snapshot decoded from the retained source bytes.

    LoadInto

    Loads the imported world into a simulation manager.

    Signature

    public void LoadInto(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldLoadOptions options)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    options MasterTech.Matter.Serialization.MatterWorldLoadOptions Application policies; null uses defaults including substance-schema validation.

    MatterWorldEncoding

    public enum MasterTech.Matter.Serialization.MatterWorldEncoding

    Defines the available matter world encoding values.

    Fields

    Member Signature Description
    Raw public static MasterTech.Matter.Serialization.MatterWorldEncoding Raw Provides the raw value.
    RunLength public static MasterTech.Matter.Serialization.MatterWorldEncoding RunLength Provides the run length value.

    MatterWorldEncodingPreference

    public enum MasterTech.Matter.Serialization.MatterWorldEncodingPreference

    Defines the available matter world encoding preference values.

    Fields

    Member Signature Description
    Auto public static MasterTech.Matter.Serialization.MatterWorldEncodingPreference Auto Provides the auto value.
    Raw public static MasterTech.Matter.Serialization.MatterWorldEncodingPreference Raw Provides the raw value.
    RunLength public static MasterTech.Matter.Serialization.MatterWorldEncodingPreference RunLength Provides the run length value.

    MatterWorldLoadOptions

    public class MasterTech.Matter.Serialization.MatterWorldLoadOptions

    Policies for applying a world document; all four options default to true.

    Properties

    Member Signature Description
    ApplySimulationSettings bool ApplySimulationSettings { get; set; } Restore saved cadence, solver and capacity settings rather than retaining the current values.
    ApplyWorldMapping bool ApplyWorldMapping { get; set; } Restore the saved grid origin and cell dimensions in world units.
    ReconfigureSimulation bool ReconfigureSimulation { get; set; } Allow reallocating an incompatible saved layout. False rejects a load that requires reconfiguration.
    ValidateSubstanceSchema bool ValidateSubstanceSchema { get; set; } Require matching ordered substance identity. Disabling this does not remap material IDs.

    Constructors

    MatterWorldLoadOptions

    Creates a new MatterWorldLoadOptions instance.

    Signature

    public MatterWorldLoadOptions()

    MatterWorldMetadata

    public class MasterTech.Matter.Serialization.MatterWorldMetadata

    User-facing information stored beside the deterministic simulation state. UserDataJson is intentionally opaque to Matter.

    Properties

    Member Signature Description
    ApplicationVersion string ApplicationVersion { get; } Application version recorded by the caller; Matter does not interpret it as a schema version.
    CreatedUtc System.DateTime CreatedUtc { get; } Creation timestamp with DateTimeKind.Utc.
    CreatedUtcTicks long CreatedUtcTicks { get; } Creation time expressed as .NET DateTime ticks in UTC.
    Description string Description { get; } Application-defined description stored with the world.
    UserDataJson string UserDataJson { get; } Opaque application data stored verbatim; Matter does not parse or validate the JSON.
    WorldName string WorldName { get; } Application-defined display name; this is not a path or stable world identifier.

    Constructors

    MatterWorldMetadata

    Creates descriptive metadata, replacing null strings with empty strings and zero creation ticks with the current UTC time.

    Signature

    public MatterWorldMetadata(string worldName, string description, string applicationVersion, string userDataJson, long createdUtcTicks)

    Parameters

    Name Type Description
    worldName string Display name; null becomes an empty string.
    description string Descriptive text; null becomes an empty string.
    applicationVersion string Caller-defined application version; null becomes an empty string.
    userDataJson string Opaque application JSON string; null becomes an empty string.
    createdUtcTicks long UTC DateTime ticks, or zero to capture the current UTC time. Values outside the DateTime range throw.

    MatterWorldPersistence

    public static class MasterTech.Matter.Serialization.MatterWorldPersistence

    Backend-neutral capture, byte serialization, file persistence, and restoration helpers. Async capture is safe for WebGPU; sync capture is retained for CPU and native compute backends.

    Fields

    Member Signature Description
    FileExtension public static string FileExtension Canonical world-document extension, including the leading dot: .matterworld.

    Methods

    Apply

    Synchronously validates and applies a world, restoring captured prior state if application fails where rollback is available.

    Signature

    public static void Apply(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldSave world, MasterTech.Matter.Serialization.MatterWorldLoadOptions options)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    world MasterTech.Matter.Serialization.MatterWorldSave Validated world document to serialize or apply. Do not mutate shared inputs during asynchronous use.
    options MasterTech.Matter.Serialization.MatterWorldLoadOptions Application policies; null uses defaults including substance-schema validation.

    ApplyAsync

    Applies a saved world with asynchronous rollback capture, including on WebGPU where synchronous GPU readback is unavailable.

    Signature

    public static System.Threading.Tasks.Task ApplyAsync(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldSave world, MasterTech.Matter.Serialization.MatterWorldLoadOptions options, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    world MasterTech.Matter.Serialization.MatterWorldSave Validated world document to serialize or apply. Do not mutate shared inputs during asynchronous use.
    options MasterTech.Matter.Serialization.MatterWorldLoadOptions Application policies; null uses defaults including substance-schema validation.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task: A task that completes after application; validation, cancellation and rollback failures are propagated.

    Remarks

    Coordinate concurrent ticks, edits and backend replacement at the application layer. A failed application attempts to restore captured prior state; if rollback also fails, the exception retains both failures.

    Capture

    Synchronously copies a complete initialized world. Native GPU capture may block; use CaptureAsync on WebGPU.

    Signature

    public static MasterTech.Matter.Serialization.MatterWorldSave Capture(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldMetadata metadata)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.

    Returns

    MasterTech.Matter.Serialization.MatterWorldSave: A caller-owned immutable world snapshot.

    CaptureAsync

    Captures metadata before asynchronous cell readback so it describes those cells. The manager must be initialized.

    Signature

    public static System.Threading.Tasks.Task<MasterTech.Matter.Serialization.MatterWorldSave> CaptureAsync(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldMetadata metadata, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task<MasterTech.Matter.Serialization.MatterWorldSave>: A task yielding the captured snapshot after readback.

    Remarks

    Metadata and mapping are captured before readback. This is not a lock on gameplay mutations; coordinate loads, edits and backend switching while awaiting the snapshot.

    LoadFileInto

    Reads a native world file and synchronously applies it using the supplied load policies.

    Signature

    public static void LoadFileInto(MasterTech.Matter.Simulation.MatterSimManager simulation, string path, MasterTech.Matter.Serialization.MatterWorldLoadOptions options)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    options MasterTech.Matter.Serialization.MatterWorldLoadOptions Application policies; null uses defaults including substance-schema validation.

    LoadFileIntoAsync

    Awaits file reading and rollback-aware world application; exceptions describe read, validation or application failures.

    Signature

    public static System.Threading.Tasks.Task LoadFileIntoAsync(MasterTech.Matter.Simulation.MatterSimManager simulation, string path, MasterTech.Matter.Serialization.MatterWorldLoadOptions options, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    options MasterTech.Matter.Serialization.MatterWorldLoadOptions Application policies; null uses defaults including substance-schema validation.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task: A task that completes after application or faults with the read/load failure.

    LoadFromFile

    Reads and validates a world file without applying it to a simulation.

    Signature

    public static MasterTech.Matter.Serialization.MatterWorldSave LoadFromFile(string path)

    Parameters

    Name Type Description
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.

    Returns

    MasterTech.Matter.Serialization.MatterWorldSave: The validated world document; invalid data or I/O failures throw.

    LoadFromFileAsync

    Reads and validates a world file asynchronously without changing simulation state.

    Signature

    public static System.Threading.Tasks.Task<MasterTech.Matter.Serialization.MatterWorldSave> LoadFromFileAsync(string path, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task<MasterTech.Matter.Serialization.MatterWorldSave>: A task yielding the validated world document; invalid data or I/O failures fault it.

    LoadInto

    Deserializes bytes and synchronously applies the world with rollback support; use ApplyAsync on WebGPU.

    Signature

    public static void LoadInto(MasterTech.Matter.Simulation.MatterSimManager simulation, byte[] serializedWorld, MasterTech.Matter.Serialization.MatterWorldLoadOptions options)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    serializedWorld byte[] Complete checksummed .matterworld document bytes.
    options MasterTech.Matter.Serialization.MatterWorldLoadOptions Application policies; null uses defaults including substance-schema validation.

    SaveToBytes

    Synchronously captures and serializes a checksummed world into caller-owned bytes.

    Signature

    public static byte[] SaveToBytes(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldMetadata metadata, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encoding)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.
    encoding MasterTech.Matter.Serialization.MatterWorldEncodingPreference Payload encoding preference; Auto chooses the serializer's supported compact representation.

    Returns

    byte[]: Caller-owned serialized world bytes.

    SaveToBytesAsync

    Asynchronously captures an initialized world and serializes it into caller-owned bytes.

    Signature

    public static System.Threading.Tasks.Task<byte[]> SaveToBytesAsync(MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldMetadata metadata, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encoding, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.
    encoding MasterTech.Matter.Serialization.MatterWorldEncodingPreference Payload encoding preference; Auto chooses the serializer's supported compact representation.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task<byte[]>: A task yielding caller-owned serialized world bytes.

    SaveToFile

    Overload 1

    Atomically writes an already-constructed world document without reading a MasterTech.Matter.Simulation.MatterSimManager. This is intended for authoring tools and import pipelines that own a CPU working copy.

    Signature

    public static void SaveToFile(string path, MasterTech.Matter.Serialization.MatterWorldSave world, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encoding)

    Parameters

    Name Type Description
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    world MasterTech.Matter.Serialization.MatterWorldSave Validated world document to serialize or apply. Do not mutate shared inputs during asynchronous use.
    encoding MasterTech.Matter.Serialization.MatterWorldEncodingPreference Payload encoding preference; Auto chooses the serializer's supported compact representation.
    Overload 2

    Captures an initialized world and atomically replaces the destination file with its serialized document.

    Signature

    public static void SaveToFile(string path, MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldMetadata metadata, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encoding)

    Parameters

    Name Type Description
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.
    encoding MasterTech.Matter.Serialization.MatterWorldEncodingPreference Payload encoding preference; Auto chooses the serializer's supported compact representation.

    SaveToFileAsync

    Overload 1

    Serializes and atomically writes an already-constructed world on a worker thread. The immutable save is used directly; no simulation capture or graphics readback is performed.

    Signature

    public static System.Threading.Tasks.Task SaveToFileAsync(string path, MasterTech.Matter.Serialization.MatterWorldSave world, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encoding, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    world MasterTech.Matter.Serialization.MatterWorldSave Validated world document to serialize or apply. Do not mutate shared inputs during asynchronous use.
    encoding MasterTech.Matter.Serialization.MatterWorldEncodingPreference Payload encoding preference; Auto chooses the serializer's supported compact representation.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task: A task that completes after writing; observe it for I/O, validation and cancellation errors.

    Overload 2

    Captures through asynchronous readback and atomically writes the document using the native filesystem.

    Signature

    public static System.Threading.Tasks.Task SaveToFileAsync(string path, MasterTech.Matter.Simulation.MatterSimManager simulation, MasterTech.Matter.Serialization.MatterWorldMetadata metadata, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encoding, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    path string Native filesystem destination or source path. Browser integrations should supply their own byte storage.
    simulation MasterTech.Matter.Simulation.MatterSimManager Configured target manager; capture/read operations require it to be initialized.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.
    encoding MasterTech.Matter.Serialization.MatterWorldEncodingPreference Payload encoding preference; Auto chooses the serializer's supported compact representation.
    cancellationToken System.Threading.CancellationToken Cancellation checked around asynchronous work; already submitted GPU or filesystem work may finish.

    Returns

    System.Threading.Tasks.Task: A task that completes after writing; observe it for I/O, validation and cancellation errors.

    MatterWorldSave

    public class MasterTech.Matter.Serialization.MatterWorldSave

    Immutable loaded or captured Matter world. Cell data is copied at the public boundary so caller mutation cannot silently change a save.

    Properties

    Member Signature Description
    CellCount int CellCount { get; } Number of cells contained in the snapshot.
    Item MasterTech.Matter.Simulation.Cell Item { get; } Returns a value copy of the cell at a flattened row-major index; an invalid index throws IndexOutOfRangeException.
    Metadata MasterTech.Matter.Serialization.MatterWorldMetadata Metadata { get; } Descriptive metadata owned by this immutable snapshot.
    Settings MasterTech.Matter.Serialization.MatterWorldSettings Settings { get; } Validated grid, solver, world-mapping, and schema information captured with the cells.

    Constructors

    MatterWorldSave

    Creates an immutable world by copying exactly Settings.CellCount cells; null cells or a mismatched length throw, and null metadata creates default metadata.

    Signature

    public MatterWorldSave(MasterTech.Matter.Serialization.MatterWorldSettings settings, MasterTech.Matter.Simulation.Cell[] cells, MasterTech.Matter.Serialization.MatterWorldMetadata metadata)

    Parameters

    Name Type Description
    settings MasterTech.Matter.Serialization.MatterWorldSettings Validated configuration whose CellCount must match the supplied array length.
    cells MasterTech.Matter.Simulation.Cell[] Non-null complete cell array; copied by the constructor.
    metadata MasterTech.Matter.Serialization.MatterWorldMetadata Optional descriptive/application metadata stored with the cells, not scene-object state.

    Methods

    CopyCells

    Copies the complete cell array so callers can modify their copy without changing this snapshot.

    Signature

    public MasterTech.Matter.Simulation.Cell[] CopyCells()

    Returns

    MasterTech.Matter.Simulation.Cell[]: A new caller-owned array containing every saved cell.

    MatterWorldSerializationException

    public class MasterTech.Matter.Serialization.MatterWorldSerializationException

    Reports an unsupported, corrupt, or unsafe world document or a failure to encode a world.

    Constructors

    MatterWorldSerializationException

    Overload 1

    Creates a serialization failure with a human-readable message and, when supplied, its original cause.

    Signature

    public MatterWorldSerializationException(string message, System.Exception innerException)

    Parameters

    Name Type Description
    message string Human-readable failure explanation.
    innerException System.Exception Original failure that caused serialization to stop.
    Overload 2

    Creates a serialization failure with a human-readable message and, when supplied, its original cause.

    Signature

    public MatterWorldSerializationException(string message)

    Parameters

    Name Type Description
    message string Human-readable failure explanation.

    MatterWorldSerializer

    public static class MasterTech.Matter.Serialization.MatterWorldSerializer

    Versioned, little-endian whole-world serializer. The envelope includes simulation settings, tick state, world mapping, metadata, substance compatibility information, and a CRC32 over the complete document.

    Fields

    Member Signature Description
    CurrentFormatVersion public static ushort CurrentFormatVersion Current binary world-document format version; independent of the package release version.
    MaximumCellCount public static int MaximumCellCount Safety limit for decoded cell count, derived from the byte budget and the packed cell size.
    MaximumMetadataBytes public static int MaximumMetadataBytes Maximum encoded metadata size in bytes (1 MiB).
    MaximumSerializedBytes public static int MaximumSerializedBytes Maximum accepted document size in bytes (256 MiB), including headers, metadata, and cell payload.

    Methods

    Deserialize

    Validates and decodes a complete world document; malformed or unsupported data throws MatterWorldSerializationException.

    Signature

    public static MasterTech.Matter.Serialization.MatterWorldSave Deserialize(byte[] serializedWorld)

    Parameters

    Name Type Description
    serializedWorld byte[] Complete checksummed .matterworld document bytes.

    Returns

    MasterTech.Matter.Serialization.MatterWorldSave: A validated immutable snapshot; no simulation is created or modified.

    GetEncoding

    Reads the encoding marker after checking the minimum header, magic, version, and encoding; invalid headers throw ArgumentException. This does not validate the complete document checksum.

    Signature

    public static MasterTech.Matter.Serialization.MatterWorldEncoding GetEncoding(byte[] serializedWorld)

    Parameters

    Name Type Description
    serializedWorld byte[] Complete checksummed .matterworld document bytes.

    Returns

    MasterTech.Matter.Serialization.MatterWorldEncoding: The raw or run-length encoding declared by the supported document header.

    Serialize

    Encodes an immutable world, metadata, schema identity, and checksum; null worlds throw ArgumentNullException and unsafe or invalid payloads throw serialization errors.

    Signature

    public static byte[] Serialize(MasterTech.Matter.Serialization.MatterWorldSave world, MasterTech.Matter.Serialization.MatterWorldEncodingPreference encodingPreference)

    Parameters

    Name Type Description
    world MasterTech.Matter.Serialization.MatterWorldSave Non-null immutable snapshot with valid material IDs and bounded metadata.
    encodingPreference MasterTech.Matter.Serialization.MatterWorldEncodingPreference Raw, run-length, or automatic selection of the smaller cell encoding.

    Returns

    byte[]: A new caller-owned binary document with its checksum.

    TryDeserialize

    Validates document size, format, checksum, cell payload, and settings without mutating a simulation; returns a diagnostic message on rejection.

    Signature

    public static bool TryDeserialize(byte[] serializedWorld, MasterTech.Matter.Serialization.MatterWorldSave& world, string& error)

    Parameters

    Name Type Description
    serializedWorld byte[] Complete checksummed .matterworld document bytes.
    world MasterTech.Matter.Serialization.MatterWorldSave& Decoded immutable world on success; null on rejection.
    error string& Human-readable rejection reason on failure; null on success.

    Returns

    bool: True when validation and decoding succeed; otherwise false with an error message.

    MatterWorldSettings

    public struct MasterTech.Matter.Serialization.MatterWorldSettings

    Simulation configuration and compatibility information captured with a saved world.

    Properties

    Member Signature Description
    CellCount int CellCount { get; } Checked product of Width and Height; integer overflow throws OverflowException.
    CellWorldSize UnityEngine.Vector2 CellWorldSize { get; } Positive Unity world-space width and height of one cell.
    ChunkSize int ChunkSize { get; } Side length of a simulation chunk in cells.
    Height int Height { get; } Number of cell rows in the saved grid.
    MaxEditsPerTick int MaxEditsPerTick { get; } Maximum edit commands accepted for one simulation tick.
    MaxTicksPerFrame int MaxTicksPerFrame { get; } Automatic catch-up tick limit per rendered frame.
    PressureIterations int PressureIterations { get; } Pressure-solver iteration budget per simulation tick.
    SimulationHz float SimulationHz { get; } Requested automatic simulation ticks per second.
    SubstanceCount int SubstanceCount { get; } Number of ordered material slots in the captured database schema.
    SubstanceSchemaHash ulong SubstanceSchemaHash { get; } Compatibility fingerprint of the ordered substance schema; checked on load when schema validation is enabled.
    TemperatureDiffusion float TemperatureDiffusion { get; } Dimensionless thermal-diffusion coefficient used by the simulation.
    TickIndex uint TickIndex { get; } Completed simulation tick counter captured with this world.
    Width int Width { get; } Number of cell columns in the saved grid.
    WorldOrigin UnityEngine.Vector2 WorldOrigin { get; } Unity world-space origin of the grid mapping.

    Constructors

    MatterWorldSettings

    Creates and validates the saved solver configuration, finite world mapping, and substance-schema identity; invalid values throw ArgumentOutOfRangeException or configuration validation errors.

    Signature

    public MatterWorldSettings(int width, int height, int chunkSize, uint tickIndex, float simulationHz, int pressureIterations, float temperatureDiffusion, int maxEditsPerTick, int maxTicksPerFrame, UnityEngine.Vector2 worldOrigin, UnityEngine.Vector2 cellWorldSize, int substanceCount, ulong substanceSchemaHash)

    Parameters

    Name Type Description
    width int Even grid width of at least two cells.
    height int Even grid height of at least two cells.
    chunkSize int Positive chunk side length in cells.
    tickIndex uint Completed simulation tick counter to preserve in the snapshot.
    simulationHz float Finite positive tick frequency in ticks per second.
    pressureIterations int Nonnegative number of pressure passes per tick.
    temperatureDiffusion float Thermal-diffusion coefficient in the validated simulation range.
    maxEditsPerTick int Positive capacity of the bounded edit queue.
    maxTicksPerFrame int Positive limit on automatic catch-up ticks in a rendered frame.
    worldOrigin UnityEngine.Vector2 Finite Unity world-space position of the grid origin.
    cellWorldSize UnityEngine.Vector2 Positive finite width and height of one cell in Unity world units.
    substanceCount int Number of ordered schema slots, between zero and 65,536 inclusive.
    substanceSchemaHash ulong Compatibility fingerprint for the captured substance ordering and schema.

    Cell

    public struct MasterTech.Matter.Simulation.Cell

    One simulation cell, with a material ID, fill, temperature, and movement/state flags. Read and edit the typed properties; coordinates are supplied separately by the manager's grid APIs.

    Properties

    Member Signature Description
    Fill byte Fill { get; set; } Encoded occupancy from zero (empty) to 255 (full); not a volume in world units.
    FlowDirection byte FlowDirection { get; set; } Encoded horizontal direction and magnitude used by the solver and surface animation.
    HorizontalMomentum int HorizontalMomentum { get; set; } Signed horizontal liquid momentum encoded in the four flow bits. Negative values move left, positive values move right, and zero is still.
    IsBurning bool IsBurning { get; set; } Reads or updates only the burning flag, preserving all other state bits.
    IsEmpty bool IsEmpty { get; } True when fill is zero, regardless of the retained material ID.
    IsFalling bool IsFalling { get; set; } Whether the cell is currently falling. The simulation recomputes this transient movement state each tick.
    IsSettled bool IsSettled { get; set; } Reads or updates only the settled flag, preserving all other state bits.
    MaterialId ushort MaterialId { get; set; } Ordered index into the world's substance database; it is not an asset instance ID.
    Temperature byte Temperature { get; set; } Whole degrees Celsius in the representable 0–255 range.

    Fields

    Member Signature Description
    AmbientTemperatureCelsius public static byte AmbientTemperatureCelsius Default ambient temperature: 20 degrees Celsius.
    BurningFlag public static uint BurningFlag Flag marking a burning cell for simulation and presentation consumers.
    FallingFlag public static uint FallingFlag Transient flag marking airborne movement in the current gravity step.
    MaximumFlowStrength public static int MaximumFlowStrength Largest magnitude representable by the horizontal flow signal.
    MaximumTemperatureCelsius public static byte MaximumTemperatureCelsius Highest representable temperature: 255 degrees Celsius.
    MinimumTemperatureCelsius public static byte MinimumTemperatureCelsius Lowest representable temperature: 0 degrees Celsius.
    SettledFlag public static uint SettledFlag Flag indicating that the solver considers this cell settled.

    Methods

    Create

    Constructs a cell from encoded material, occupancy, temperature and flags without looking up a database.

    Signature

    public static MasterTech.Matter.Simulation.Cell Create(ushort materialId, byte fill, byte temperature, uint flags)

    Parameters

    Name Type Description
    materialId ushort Stable positional ID in the target substance database.
    fill byte Encoded cell occupancy from 0 to 255.
    temperature byte Whole degrees Celsius encoded in the inclusive 0–255 range.
    flags uint Packed operation/cell state flags; use the documented flags for this operation.

    Returns

    MasterTech.Matter.Simulation.Cell: A value-type cell containing the requested encoded data and flags.

    Equals

    Overload 1

    Compares both packed data and flags; cells with different transient state are unequal.

    Signature

    public bool Equals(MasterTech.Matter.Simulation.Cell other)

    Parameters

    Name Type Description
    other MasterTech.Matter.Simulation.Cell Cell to compare, including transient flags.

    Returns

    bool: True only when both packed words match.

    Overload 2

    Compares both packed data and flags; cells with different transient state are unequal.

    Signature

    public virtual bool Equals(object obj)

    Parameters

    Name Type Description
    obj object Object to compare; a non-cell object is unequal.

    Returns

    bool: True only when both packed words match.

    GetHashCode

    Combines packed data and flags into a hash consistent with cell equality.

    Signature

    public virtual int GetHashCode()

    Returns

    int: A hash derived from both stored words.

    operator ==

    Compares two values using their field equality contract.

    Signature

    public static bool operator ==(MasterTech.Matter.Simulation.Cell left, MasterTech.Matter.Simulation.Cell right)

    Parameters

    Name Type Description
    left MasterTech.Matter.Simulation.Cell First value to compare.
    right MasterTech.Matter.Simulation.Cell Second value to compare.

    Returns

    bool: True when the values are equal; otherwise false.

    operator !=

    Compares two values using their field equality contract.

    Signature

    public static bool operator !=(MasterTech.Matter.Simulation.Cell left, MasterTech.Matter.Simulation.Cell right)

    Parameters

    Name Type Description
    left MasterTech.Matter.Simulation.Cell First value to compare.
    right MasterTech.Matter.Simulation.Cell Second value to compare.

    Returns

    bool: True when the values are different; otherwise false.

    CellExchangeResult

    public struct MasterTech.Matter.Simulation.CellExchangeResult

    Result of extracting or injecting matter through the manager's single-cell APIs. Check Succeeded before using the transferred amount, material, and temperature.

    Properties

    Member Signature Description
    Amount byte Amount { get; } Actually transferred fill from zero to 255; may be less than requested.
    MaterialId ushort MaterialId { get; } Typed material ID for the transferred fill.
    Succeeded bool Succeeded { get; } True when at least one unit of encoded fill was transferred.
    Temperature byte Temperature { get; } Temperature of the transferred material in the 0–255 Celsius range.

    EditCommand

    public struct MasterTech.Matter.Simulation.EditCommand

    A queued brush operation that paints, removes, heats, or moves matter. Create commands with the factory methods below and submit them with MatterSimManager.TryQueueEdit; accepted commands take effect during a simulation tick.

    Properties

    Member Signature Description
    Operation MasterTech.Matter.Simulation.SimEditOperation Operation { get; set; } Typed view of the command's operation discriminator.
    Position UnityEngine.Vector2Int Position { get; set; } Brush center in integer grid coordinates; setting it updates x and y.

    Fields

    Member Signature Description
    DefaultTemperature public static byte DefaultTemperature Temperature used by paint helpers when omitted: ambient 20 degrees Celsius.

    Methods

    AddFill

    Creates a command that adds bounded fill of a selected material without exceeding cell capacity.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand AddFill(int x, int y, uint radius, ushort materialId, byte amount, byte temperature)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.
    materialId ushort Stable positional ID in the target substance database.
    amount byte Requested encoded fill transfer, bounded by available material or capacity.
    temperature byte Whole degrees Celsius encoded in the inclusive 0–255 range.

    Returns

    MasterTech.Matter.Simulation.EditCommand: A bounded fill-addition command to submit through TryQueueEdit.

    Erase

    Creates a circular command that removes occupancy inside the brush.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand Erase(int x, int y, uint radius)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.

    Returns

    MasterTech.Matter.Simulation.EditCommand: An erase command to submit through TryQueueEdit.

    Excavate

    Removes only solid, powder, and static cells without igniting nearby material. This uses the simulation's solid-aware explosion operation while making the non-destructive mining intent explicit to callers.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand Excavate(int x, int y, uint radius)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.

    Returns

    MasterTech.Matter.Simulation.EditCommand: An erase/excavation command ready for validated submission.

    Explode

    Destroys solid terrain while preserving exposed fluids. Flammable cells inside the brush are ignited when is non-zero, allowing the GPU simulation to continue the chain reaction.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand Explode(int x, int y, uint radius, byte ignitionTemperature)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.
    ignitionTemperature byte Encoded Celsius temperature applied by the explosion command.

    Returns

    MasterTech.Matter.Simulation.EditCommand: A bounded explosion command ready for validated submission.

    Paint

    Creates a circular material replacement command; submission and application are separate operations.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand Paint(int x, int y, uint radius, ushort materialId, byte fill, byte temperature, uint flags)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.
    materialId ushort Stable positional ID in the target substance database.
    fill byte Encoded cell occupancy from 0 to 255.
    temperature byte Whole degrees Celsius encoded in the inclusive 0–255 range.
    flags uint Packed operation/cell state flags; use the documented flags for this operation.

    Returns

    MasterTech.Matter.Simulation.EditCommand: A command to submit through TryQueueEdit.

    SetHorizontalMomentum

    Sets the signed horizontal momentum of liquid cells inside the brush without replacing their material, fill, temperature, or non-flow flags. This is useful for deterministic gameplay impulses such as a rigid body's water-entry wave.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand SetHorizontalMomentum(int x, int y, uint radius, int momentum)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.
    momentum int Signed horizontal momentum signal; the factory clamps it to the supported encoding.

    Returns

    MasterTech.Matter.Simulation.EditCommand: A command encoding the requested bounded horizontal signal.

    SetTemperature

    Creates a circular temperature edit using Matter's encoded Celsius range.

    Signature

    public static MasterTech.Matter.Simulation.EditCommand SetTemperature(int x, int y, uint radius, byte temperature)

    Parameters

    Name Type Description
    x int Brush or cell horizontal coordinate in the simulation grid.
    y int Brush or cell vertical coordinate in the simulation grid.
    radius uint Brush radius in cells; zero targets one center cell.
    temperature byte Whole degrees Celsius encoded in the inclusive 0–255 range.

    Returns

    MasterTech.Matter.Simulation.EditCommand: A temperature command to submit through TryQueueEdit.

    MatterPresentationResources

    public struct MasterTech.Matter.Simulation.MatterPresentationResources

    Borrowed, read-only presentation resources for the active backend. Consumers must reacquire this view after MasterTech.Matter.Simulation.MatterSimManager.PresentationResourcesChanged and must never dispose any buffer exposed by it.

    Properties

    Member Signature Description
    Cells UnityEngine.ComputeBuffer Cells { get; } Borrowed cell buffer for presentation. Reacquire after invalidation and never release it yourself.
    Generation uint Generation { get; } Generation token used to detect stale resources after buffer replacement or shutdown.
    GridSize UnityEngine.Vector2Int GridSize { get; } Width and height, in cells, associated with this resource generation.
    IsValid bool IsValid { get; } True only while all three borrowed buffers are allocated and valid; does not extend their lifetime.
    Reactions UnityEngine.ComputeBuffer Reactions { get; } Borrowed baked reaction buffer; consumers must not dispose or replace it.
    SubstanceCount int SubstanceCount { get; } Number of substance records valid in the borrowed substance buffer.
    Substances UnityEngine.ComputeBuffer Substances { get; } Borrowed baked substance buffer belonging to the simulation/database lifetime.

    MatterSimManager

    public class MasterTech.Matter.Simulation.MatterSimManager

    Backend-neutral fixed-rate simulation facade. Compute remains the default on supported hardware; Burst provides the no-compute fallback.

    Usage: Use a scene component from Quick Setup, or create one with GameObject.AddComponent<MatterSimManager>(). Initialize it before accessing cells and call Shutdown when its simulation lifetime ends.

    Properties

    Member Signature Description
    ActiveBackend MasterTech.Matter.Simulation.SimulationBackendKind ActiveBackend { get; } The active or currently preferred concrete backend.
    AvailableCpuWorkerThreadCount int AvailableCpuWorkerThreadCount { get; } The Unity Job System workers currently available to Matter.
    CellWorldSize UnityEngine.Vector2 CellWorldSize { get; } The positive world-space width and height of one cell.
    CpuWorkerThreadCount int CpuWorkerThreadCount { get; set; } Requested CPU worker count: zero uses every available worker, one uses the serial reference path, and larger values cap Matter's worker lanes.
    CreateCpuPresentationBuffer bool CreateCpuPresentationBuffer { get; set; } Whether the CPU backend uploads a GPU presentation buffer for renderers. Change this setting before initialization.
    EffectiveCpuWorkerThreadCount int EffectiveCpuWorkerThreadCount { get; } The worker count resolved from the request and availability.
    GridSize UnityEngine.Vector2Int GridSize { get; } The current grid width and height in cells.
    IsBackendSwitching bool IsBackendSwitching { get; } Whether an asynchronous or synchronous replacement is active.
    IsInitialized bool IsInitialized { get; } Whether a backend is allocated and ready to simulate.
    LastPresentationUploadBytes long LastPresentationUploadBytes { get; } Bytes uploaded by the most recent CPU presentation refresh.
    LastPresentationUploadMilliseconds double LastPresentationUploadMilliseconds { get; } Duration of the most recent CPU presentation upload.
    MemoryStats MasterTech.Matter.Simulation.SimulationMemoryStats MemoryStats { get; } Current backend allocation and upload-memory diagnostics.
    RequestedBackend MasterTech.Matter.Simulation.SimulationBackendPreference RequestedBackend { get; set; } The backend policy used during initialization or switching.
    Settings MasterTech.Matter.Simulation.MatterSimulationSettings Settings { get; } The allocated grid and solver configuration.
    SimulateAutomatically bool SimulateAutomatically { get; set; } Whether Unity Update advances the fixed-rate simulation automatically. Disable this when another system calls MasterTech.Matter.Simulation.MatterSimManager.SimulateTick.
    SimulationShader UnityEngine.ComputeShader SimulationShader { get; set; } The compute shader used by the GPU simulation backend.
    SubstanceCount int SubstanceCount { get; } The number of substances bound to the active backend.
    SubstanceDatabase MasterTech.Matter.Data.SubstanceDatabase SubstanceDatabase { get; set; } The authored substance database baked and bound during initialization. Assigning a new database while initialized refreshes owned buffers.
    ThermalSourcesEnabled bool ThermalSourcesEnabled { get; set; } Enables registered scene sources. Substance thermal behavior remains active.
    TickIndex uint TickIndex { get; } The number of public ticks completed or restored.
    WorldOrigin UnityEngine.Vector2 WorldOrigin { get; } The world position of the grid's lower-left edge.

    Fields

    Member Signature Description
    SingleThreadedCpuWorkerThreads public static int SingleThreadedCpuWorkerThreads Uses the deterministic single-threaded CPU reference path.
    UnlimitedCpuWorkerThreads public static int UnlimitedCpuWorkerThreads Uses every Unity Job System worker available to Matter.

    Events

    Member Signature Description
    BackendChanged public event System.Action<MasterTech.Matter.Simulation.SimulationBackendKind> BackendChanged Raised after the active simulation backend changes.
    PresentationResourcesChanged public event System.Action<uint> PresentationResourcesChanged Raised whenever borrowed presentation buffers are rebound or become invalid. Subscribers must reacquire them with MasterTech.Matter.Simulation.MatterSimManager.TryGetPresentationResources(MasterTech.Matter.Simulation.MatterPresentationResources@).
    TickCompleted public event System.Action<uint> TickCompleted Raised after a public simulation tick completes.
    TopologyChanged public event System.Action TopologyChanged Raised when edits, loading, chunk writes, or backend replacement can invalidate renderer or integration-system topology caches.
    WorldLoaded public event System.Action<uint> WorldLoaded Raised after a saved world is applied to the manager.

    Methods

    CanUseBackend

    Checks whether a simulation backend can run with the current graphics capabilities and assigned shaders.

    Signature

    public bool CanUseBackend(MasterTech.Matter.Simulation.SimulationBackendKind kind, string& reason)

    Parameters

    Name Type Description
    kind MasterTech.Matter.Simulation.SimulationBackendKind The concrete backend to test.
    reason string& Empty when the backend is available; otherwise, an actionable explanation of the missing capability or assignment.

    Returns

    bool: true when the backend is available.

    CellToWorldCenter

    Returns the world-space center of one valid cell.

    Signature

    public UnityEngine.Vector2 CellToWorldCenter(int x, int y)

    Parameters

    Name Type Description
    x int The zero-based horizontal cell coordinate.
    y int The zero-based vertical cell coordinate.

    Returns

    UnityEngine.Vector2: The cell center in world space.

    ClearDirtyFlags

    Clears all backend dirty-chunk flags.

    Signature

    public void ClearDirtyFlags()

    ConfigureWorldMapping

    Defines the world-space origin and size of simulation cells used by the coordinate-conversion helpers and renderers.

    Signature

    public void ConfigureWorldMapping(UnityEngine.Vector2 origin, UnityEngine.Vector2 sizePerCell)

    Parameters

    Name Type Description
    origin UnityEngine.Vector2 The world position of the grid's lower-left edge.
    sizePerCell UnityEngine.Vector2 Positive world-space width and height per cell.

    ConsumeDirtyFlags

    Copies current dirty-chunk flags to a caller-owned GPU buffer and clears the backend's flags in the same operation.

    Signature

    public void ConsumeDirtyFlags(UnityEngine.ComputeBuffer destination)

    Parameters

    Name Type Description
    destination UnityEngine.ComputeBuffer The buffer that receives one flag per chunk.

    CopyChunkTo

    Copies one compact chunk directly into a GPU buffer.

    Signature

    public void CopyChunkTo(UnityEngine.ComputeBuffer destination, int chunkIndex)

    Parameters

    Name Type Description
    destination UnityEngine.ComputeBuffer The target GPU buffer.
    chunkIndex int The row-major chunk index.

    ExtractCellAsync

    Removes up to the requested fill from one cell using asynchronous GPU readback when required by the active backend.

    Signature

    public System.Threading.Tasks.Task<MasterTech.Matter.Simulation.CellExchangeResult> ExtractCellAsync(UnityEngine.Vector2Int cell, byte requestedAmount)

    Parameters

    Name Type Description
    cell UnityEngine.Vector2Int The cell coordinate to extract from.
    requestedAmount byte The maximum fill amount to remove.

    Returns

    System.Threading.Tasks.Task<MasterTech.Matter.Simulation.CellExchangeResult>: A task whose result describes the extracted material.

    Initialize

    Validates the configuration, creates the requested simulation backend, binds substance data, and locks the allocated grid layout. Calling this method on an initialized manager has no effect.

    Signature

    public void Initialize()

    InjectCellAsync

    Adds up to the requested fill to one compatible cell using asynchronous GPU readback when required by the active backend.

    Signature

    public System.Threading.Tasks.Task<MasterTech.Matter.Simulation.CellExchangeResult> InjectCellAsync(UnityEngine.Vector2Int cell, ushort materialId, byte requestedAmount, byte temperature)

    Parameters

    Name Type Description
    cell UnityEngine.Vector2Int The cell coordinate to inject into.
    materialId ushort The stable substance identifier to add.
    requestedAmount byte The maximum fill amount to add.
    temperature byte The temperature of the injected fill.

    Returns

    System.Threading.Tasks.Task<MasterTech.Matter.Simulation.CellExchangeResult>: A task whose result describes the injected amount.

    LoadInitialCells

    Replaces the complete grid and resets the public tick index to zero.

    Signature

    public void LoadInitialCells(MasterTech.Matter.Simulation.Cell[] cells)

    Parameters

    Name Type Description
    cells MasterTech.Matter.Simulation.Cell[] Exactly MasterTech.Matter.Simulation.MatterSimulationSettings.CellCount cells in row-major order.

    LoadWorldCells

    Replaces the complete backend-neutral grid and restores the saved simulation tick. Both GPU ping-pong buffers or the CPU native state are updated by the active backend.

    Signature

    public void LoadWorldCells(MasterTech.Matter.Simulation.Cell[] cells, uint tickIndex)

    Parameters

    Name Type Description
    cells MasterTech.Matter.Simulation.Cell[] Exactly MasterTech.Matter.Simulation.MatterSimulationSettings.CellCount cells in row-major order.
    tickIndex uint The saved public tick index to restore.

    ReadAllCells

    Copies the complete grid into caller-owned memory. This operation is synchronous and can block while using the GPU backend.

    Signature

    public void ReadAllCells(MasterTech.Matter.Simulation.Cell[] destination)

    Parameters

    Name Type Description
    destination MasterTech.Matter.Simulation.Cell[] An array with room for at least MasterTech.Matter.Simulation.MatterSimulationSettings.CellCount cells.

    ReadAllCellsAsync

    Reads the complete grid without blocking WebGPU's graphics queue. CPU backends complete synchronously.

    Signature

    public System.Threading.Tasks.Task ReadAllCellsAsync(MasterTech.Matter.Simulation.Cell[] destination)

    Parameters

    Name Type Description
    destination MasterTech.Matter.Simulation.Cell[] An array with room for at least MasterTech.Matter.Simulation.MatterSimulationSettings.CellCount cells.

    Returns

    System.Threading.Tasks.Task: A task that completes after the destination is populated.

    ReadChunk

    Copies the valid cells of one chunk into caller-owned memory. Edge chunks contain fewer cells when the grid is not evenly divisible.

    Signature

    public int ReadChunk(int chunkIndex, MasterTech.Matter.Simulation.Cell[] destination, int destinationOffset)

    Parameters

    Name Type Description
    chunkIndex int The row-major chunk index.
    destination MasterTech.Matter.Simulation.Cell[] The array that receives compact cells.
    destinationOffset int The first destination element to overwrite.

    Returns

    int: The number of cells copied.

    ReadChunkAsync

    Reads a compact valid chunk through AsyncGPUReadback when the GPU backend is active.

    Signature

    public System.Threading.Tasks.Task<int> ReadChunkAsync(int chunkIndex, MasterTech.Matter.Simulation.Cell[] destination, int destinationOffset)

    Parameters

    Name Type Description
    chunkIndex int The row-major chunk index.
    destination MasterTech.Matter.Simulation.Cell[] The array that receives compact cells.
    destinationOffset int The first destination element to overwrite.

    Returns

    System.Threading.Tasks.Task<int>: A task whose result is the number of cells copied.

    SetBackendAsync

    Switches backends while using asynchronous cell readback when the current graphics API requires it. If cells change during readback, the switch fails without replacing the newer state; callers may retry.

    Signature

    public System.Threading.Tasks.Task<MasterTech.Matter.Simulation.SimulationBackendSwitchResult> SetBackendAsync(MasterTech.Matter.Simulation.SimulationBackendPreference preference, bool preserveState, System.Threading.CancellationToken cancellationToken)

    Parameters

    Name Type Description
    preference MasterTech.Matter.Simulation.SimulationBackendPreference The preferred backend selection policy.
    preserveState bool Whether to copy the current cells into the replacement backend.
    cancellationToken System.Threading.CancellationToken A token that can cancel readback before the replacement is committed.

    Returns

    System.Threading.Tasks.Task<MasterTech.Matter.Simulation.SimulationBackendSwitchResult>: A task whose result describes the completed switch.

    Shutdown

    Disposes the active backend, releases its runtime state, clears queued edits, and unlocks the grid layout for reconfiguration.

    Signature

    public void Shutdown()

    SimulateTick

    Applies queued edits, advances the active backend by one public tick, updates the tick index, and raises completion notifications.

    Signature

    public void SimulateTick()

    TryExtractCell

    Synchronously removes up to the requested fill from one cell.

    Signature

    public bool TryExtractCell(UnityEngine.Vector2Int cell, byte requestedAmount, MasterTech.Matter.Simulation.CellExchangeResult& result)

    Parameters

    Name Type Description
    cell UnityEngine.Vector2Int The cell coordinate to extract from.
    requestedAmount byte The maximum fill amount to remove.
    result MasterTech.Matter.Simulation.CellExchangeResult& The material and amount actually extracted.

    Returns

    bool: true when the exchange was executed; otherwise, false. WebGPU callers should use MasterTech.Matter.Simulation.MatterSimManager.ExtractCellAsync(UnityEngine.Vector2Int,System.Byte).

    TryGetPresentationResources

    Tries to borrow the active backend's read-only presentation view. The manager owns every buffer in the view. Callers must reacquire it after MasterTech.Matter.Simulation.MatterSimManager.PresentationResourcesChanged is raised.

    Signature

    public bool TryGetPresentationResources(MasterTech.Matter.Simulation.MatterPresentationResources& resources)

    Parameters

    Name Type Description
    resources MasterTech.Matter.Simulation.MatterPresentationResources& Borrowed resource snapshot on success; reacquire after invalidation and never dispose its buffers.

    Returns

    bool: True when the required borrowed presentation buffers are available.

    TryInjectCell

    Synchronously adds up to the requested fill to one compatible cell.

    Signature

    public bool TryInjectCell(UnityEngine.Vector2Int cell, ushort materialId, byte requestedAmount, byte temperature, MasterTech.Matter.Simulation.CellExchangeResult& result)

    Parameters

    Name Type Description
    cell UnityEngine.Vector2Int The cell coordinate to inject into.
    materialId ushort The stable substance identifier to add.
    requestedAmount byte The maximum fill amount to add.
    temperature byte The temperature of the injected fill.
    result MasterTech.Matter.Simulation.CellExchangeResult& The amount actually injected.

    Returns

    bool: true when the exchange was executed; otherwise, false. WebGPU callers should use MasterTech.Matter.Simulation.MatterSimManager.InjectCellAsync(UnityEngine.Vector2Int,System.UInt16,System.Byte,System.Byte).

    TryQueueEdit

    Queues one edit for the next simulation tick without allocating.

    Signature

    public bool TryQueueEdit(MasterTech.Matter.Simulation.EditCommand command)

    Parameters

    Name Type Description
    command MasterTech.Matter.Simulation.EditCommand The validated edit command to enqueue.

    Returns

    bool: false when the manager is not initialized or the per-tick edit queue is full; otherwise, true.

    TrySetBackend

    Overload 1

    Attempts a synchronous backend switch and returns the selected backend together with success or failure information.

    Signature

    public MasterTech.Matter.Simulation.SimulationBackendSwitchResult TrySetBackend(MasterTech.Matter.Simulation.SimulationBackendPreference preference, bool preserveState)

    Parameters

    Name Type Description
    preference MasterTech.Matter.Simulation.SimulationBackendPreference The preferred backend selection policy.
    preserveState bool Whether to copy the current cells into the replacement backend.

    Returns

    MasterTech.Matter.Simulation.SimulationBackendSwitchResult: The complete backend-switch result.

    Overload 2

    Attempts a synchronous backend switch and reports a concise failure reason. Use MasterTech.Matter.Simulation.MatterSimManager.SetBackendAsync(MasterTech.Matter.Simulation.SimulationBackendPreference,System.Boolean,System.Threading.CancellationToken) when WebGPU readback may be required to preserve state.

    Signature

    public bool TrySetBackend(MasterTech.Matter.Simulation.SimulationBackendPreference preference, bool preserveState, string& failureReason)

    Parameters

    Name Type Description
    preference MasterTech.Matter.Simulation.SimulationBackendPreference The preferred backend selection policy.
    preserveState bool Whether to copy the current cells into the replacement backend.
    failureReason string& Empty on success; otherwise, the reason the switch was rejected.

    Returns

    bool: true when the switch succeeds.

    TryWorldToCell

    Converts a world position to a row-major grid coordinate.

    Signature

    public bool TryWorldToCell(UnityEngine.Vector2 worldPosition, UnityEngine.Vector2Int& cell)

    Parameters

    Name Type Description
    worldPosition UnityEngine.Vector2 The world position to convert.
    cell UnityEngine.Vector2Int& The computed cell coordinate.

    Returns

    bool: true when the coordinate lies inside the allocated grid; otherwise, false.

    WriteChunk

    Replaces the valid cells of one chunk and raises the topology-change notification used by rendering and integration systems.

    Signature

    public int WriteChunk(int chunkIndex, MasterTech.Matter.Simulation.Cell[] source, int sourceOffset)

    Parameters

    Name Type Description
    chunkIndex int The row-major chunk index.
    source MasterTech.Matter.Simulation.Cell[] The array containing compact chunk cells.
    sourceOffset int The first source element to read.

    Returns

    int: The number of cells written.

    MatterSimulationSettings

    public class MasterTech.Matter.Simulation.MatterSimulationSettings

    Serializable simulation sizing and cadence settings. Defaults match the 512 x 256 world and 64 x 64 network chunks.

    Properties

    Member Signature Description
    CellCount int CellCount { get; } Checked product of width and height, used to size complete-world cell arrays.
    ChunkCount int ChunkCount { get; } Checked total number of chunks covering the configured grid.
    ChunkCountX int ChunkCountX { get; } Number of horizontal chunks, including a partial final chunk.
    ChunkCountY int ChunkCountY { get; } Number of vertical chunks, including a partial final chunk.
    ChunkSize int ChunkSize { get; set; } Positive chunk side length in cells; cannot change while the allocation is locked.
    Height int Height { get; set; } Even grid height of at least two cells. Allocation locks prevent changing it while initialized.
    MargolusBlockCountX int MargolusBlockCountX { get; } Number of two-cell-wide movement blocks across the grid.
    MargolusBlockCountY int MargolusBlockCountY { get; } Number of two-cell-high movement blocks up the grid.
    MaxEditsPerTick int MaxEditsPerTick { get; set; } Positive bounded edit-queue capacity fixed by the initialized allocation.
    MaxTicksPerFrame int MaxTicksPerFrame { get; set; } Catch-up limit of at least one automatic tick per rendered frame.
    PressureIterations int PressureIterations { get; set; } Nonnegative number of pressure passes per tick. Zero disables those passes.
    SimulationHz float SimulationHz { get; set; } Finite positive automatic tick frequency in ticks per second; runtime changes are allowed.
    TemperatureDiffusion float TemperatureDiffusion { get; set; } Finite heat-diffusion factor in [0, 1]; runtime changes do not resize the grid.
    TickInterval float TickInterval { get; } Seconds per public tick, equal to one divided by SimulationHz.
    Width int Width { get; set; } Even grid width of at least two cells. Allocation locks prevent changing it while initialized.

    Fields

    Member Signature Description
    DefaultChunkSize public static int DefaultChunkSize Default chunk side length of 64 cells.
    DefaultHeight public static int DefaultHeight Default allocation height of 256 cells; samples may author a different grid.
    DefaultPressureIterations public static int DefaultPressureIterations Default count of twelve pressure iterations per public tick.
    DefaultSimulationHz public static float DefaultSimulationHz Default automatic tick frequency of 120 ticks per second.
    DefaultWidth public static int DefaultWidth Default allocation width of 512 cells; samples may author a different grid.

    Constructors

    MatterSimulationSettings

    Overload 1

    Creates simulation settings; the parameterized constructor validates its supplied allocation and cadence.

    Signature

    public MatterSimulationSettings()

    Overload 2

    Creates simulation settings; the parameterized constructor validates its supplied allocation and cadence.

    Signature

    public MatterSimulationSettings(int width, int height, int chunkSize, float simulationHz, int pressureIterations, int maxEditsPerTick)

    Parameters

    Name Type Description
    width int Even grid width of at least two cells.
    height int Even grid height of at least two cells.
    chunkSize int Positive chunk side length in cells.
    simulationHz float Finite positive tick frequency in ticks per second.
    pressureIterations int Nonnegative number of pressure passes per tick.
    maxEditsPerTick int Positive capacity of the bounded edit queue.

    Methods

    DivideRoundUp

    Computes the number of divisor-sized groups needed to contain value entries using integer arithmetic.

    Signature

    public static int DivideRoundUp(int value, int divisor)

    Parameters

    Name Type Description
    value int Value to encode, decode or validate as described by the operation.
    divisor int Positive size of each group.

    Returns

    int: The integer ceiling of value divided by divisor.

    Validate

    Rejects invalid dimensions, cadence, pressure, diffusion and capacity with argument exceptions.

    Signature

    public void Validate()

    MatterThermalSource

    public class MasterTech.Matter.Simulation.MatterThermalSource

    Applies temperature control to occupied cells in a circular grid region. Evaluated by its simulation once per tick, including editor preview. Scene/prefab serialization owns this object; world saves contain cells.

    Usage: Add this component through GameObject > Matter > Heating Source or Cooling Source, then assign its simulation. See thermal authoring.

    Properties

    Member Signature Description
    EdgeFalloff float EdgeFalloff { get; } Zero is uniform; one decreases linearly to zero at the boundary.
    Mode MasterTech.Matter.Simulation.ThermalSourceMode Mode { get; } Whether the source heats, cools, or does either to maintain its target.
    Radius float Radius { get; } Circular radius measured in grid cells.
    Simulation MasterTech.Matter.Simulation.MatterSimManager Simulation { get; set; } Simulation receiving this source; reassignment updates registration.
    Strength float Strength { get; } Maximum central temperature change per simulated second.
    TargetTemperature int TargetTemperature { get; } Target in whole Celsius degrees, from 0 through 255.

    Methods

    Configure

    Configures a source. Invalid finite ranges throw; no cells change until a tick runs.

    Signature

    public void Configure(MasterTech.Matter.Simulation.MatterSimManager owner, int targetCelsius, float degreesPerSecond, float radiusCells, MasterTech.Matter.Simulation.ThermalSourceMode sourceMode, float falloff)

    Parameters

    Name Type Description
    owner MasterTech.Matter.Simulation.MatterSimManager Simulation that owns the affected grid.
    targetCelsius int Whole Celsius degrees, 0 through 255.
    degreesPerSecond float Maximum rate, 0 through 65535. Zero disables the effect.
    radiusCells float Positive radius, at least half a cell.
    sourceMode MasterTech.Matter.Simulation.ThermalSourceMode Allowed direction of temperature change.
    falloff float Linear edge falloff amount in [0, 1].

    SimEditOperation

    public enum MasterTech.Matter.Simulation.SimEditOperation

    Defines the available sim edit operation values.

    Fields

    Member Signature Description
    AddFill public static MasterTech.Matter.Simulation.SimEditOperation AddFill Provides the add fill value.
    Erase public static MasterTech.Matter.Simulation.SimEditOperation Erase Provides the erase value.
    Explode public static MasterTech.Matter.Simulation.SimEditOperation Explode Provides the explode value.
    Paint public static MasterTech.Matter.Simulation.SimEditOperation Paint Provides the paint value.
    SetHorizontalMomentum public static MasterTech.Matter.Simulation.SimEditOperation SetHorizontalMomentum Provides the set horizontal momentum value.
    SetTemperature public static MasterTech.Matter.Simulation.SimEditOperation SetTemperature Provides the set temperature value.

    SimulationBackendKind

    public enum MasterTech.Matter.Simulation.SimulationBackendKind

    Defines the available simulation backend kind values.

    Fields

    Member Signature Description
    CpuBurst public static MasterTech.Matter.Simulation.SimulationBackendKind CpuBurst Provides the CPU burst value.
    GpuCompute public static MasterTech.Matter.Simulation.SimulationBackendKind GpuCompute Provides the GPU compute value.

    SimulationBackendPreference

    public enum MasterTech.Matter.Simulation.SimulationBackendPreference

    Selects the simulation implementation used by MasterTech.Matter.Simulation.MatterSimManager. Auto preserves the compute path on supported hardware and falls back to the Burst CPU implementation when compute shaders are unavailable.

    Fields

    Member Signature Description
    Auto public static MasterTech.Matter.Simulation.SimulationBackendPreference Auto Provides the auto value.
    CpuBurst public static MasterTech.Matter.Simulation.SimulationBackendPreference CpuBurst Provides the CPU burst value.
    GpuCompute public static MasterTech.Matter.Simulation.SimulationBackendPreference GpuCompute Provides the GPU compute value.

    SimulationBackendSwitchResult

    public struct MasterTech.Matter.Simulation.SimulationBackendSwitchResult

    Result of a backend request, including the backend actually active and a readable failure reason.

    Properties

    Member Signature Description
    ActiveBackend MasterTech.Matter.Simulation.SimulationBackendKind ActiveBackend { get; } Backend left active after the attempted operation; do not infer it solely from the request.
    FailureReason string FailureReason { get; } Explanation of a rejected or failed switch; empty for a successful result.
    Succeeded bool Succeeded { get; } True when the requested switch completed successfully.

    Constructors

    SimulationBackendSwitchResult

    Builds a result without performing a backend switch.

    Signature

    public SimulationBackendSwitchResult(bool succeeded, MasterTech.Matter.Simulation.SimulationBackendKind activeBackend, string failureReason)

    Parameters

    Name Type Description
    succeeded bool Whether the backend operation completed successfully.
    activeBackend MasterTech.Matter.Simulation.SimulationBackendKind Backend remaining active after the operation.
    failureReason string Readable failure explanation; empty on success.

    Methods

    Failure

    Creates a failure result while retaining the backend that remains active.

    Signature

    public static MasterTech.Matter.Simulation.SimulationBackendSwitchResult Failure(MasterTech.Matter.Simulation.SimulationBackendKind backend, string reason)

    Parameters

    Name Type Description
    backend MasterTech.Matter.Simulation.SimulationBackendKind Backend represented by the result.
    reason string Readable explanation for the failure.

    Returns

    MasterTech.Matter.Simulation.SimulationBackendSwitchResult: A failure result containing the supplied reason.

    Success

    Creates a successful result for the supplied active backend.

    Signature

    public static MasterTech.Matter.Simulation.SimulationBackendSwitchResult Success(MasterTech.Matter.Simulation.SimulationBackendKind backend)

    Parameters

    Name Type Description
    backend MasterTech.Matter.Simulation.SimulationBackendKind Backend represented by the result.

    Returns

    MasterTech.Matter.Simulation.SimulationBackendSwitchResult: A success result with no failure reason.

    SimulationMemoryStats

    public struct MasterTech.Matter.Simulation.SimulationMemoryStats

    Represents simulation memory stats data.

    Properties

    Member Signature Description
    CpuNativeBytes long CpuNativeBytes { get; } Gets the CPU native bytes.
    GpuPresentationBytes long GpuPresentationBytes { get; } Gets the GPU presentation bytes.
    GpuSimulationBytes long GpuSimulationBytes { get; } Gets the GPU simulation bytes.
    TotalTrackedBytes long TotalTrackedBytes { get; } Gets the total tracked bytes.

    Constructors

    SimulationMemoryStats

    Creates a new SimulationMemoryStats instance.

    Signature

    public SimulationMemoryStats(long cpuNativeBytes, long gpuSimulationBytes, long gpuPresentationBytes)

    Parameters

    Name Type Description
    cpuNativeBytes long The CPU native bytes value.
    gpuSimulationBytes long The GPU simulation bytes value.
    gpuPresentationBytes long The GPU presentation bytes value.

    ThermalSourceMode

    public enum MasterTech.Matter.Simulation.ThermalSourceMode

    Direction allowed by a target-temperature source.

    Fields

    Member Signature Description
    CoolOnly public static MasterTech.Matter.Simulation.ThermalSourceMode CoolOnly Cools cells above the target; never heats colder cells.
    HeatOnly public static MasterTech.Matter.Simulation.ThermalSourceMode HeatOnly Heats cells below the target; never cools hotter cells.
    MaintainTemperature public static MasterTech.Matter.Simulation.ThermalSourceMode MaintainTemperature Heats or cools occupied cells toward the target.
    In this article
    Back to top Generated by DocFX