stride3d/stride · error · Exception

height type is not supported.

Error message

{ heightType } height type is not supported.

What it means

After converting pixel data, the compiler builds a Heightmap for the configured HeightType (Byte or Short). Any HeightType value other than the supported enum cases reaches the switch's default and throws. This indicates a corrupted or hand-edited asset configuration.

Solutions

  1. Set HeightType to a valid value (Byte or Short) in the editor
  2. Delete and re-import the heightmap asset to regenerate a clean configuration
  3. Inspect the .sdfloat file for the HeightType field and correct it
  4. Upgrade/downgrade assets through the editor's asset migration instead of manual edits

Example fix

// before
<HeightType>42</HeightType> <!-- invalid enum -->
// after
<HeightType>Byte</HeightType>
Defensive patterns

Strategy: validation

Validate before calling

if (!Enum.IsDefined(typeof(HeightType), heightmapAsset.HeightType))
    throw new InvalidOperationException($"Invalid HeightType: {heightmapAsset.HeightType}");

Prevention

When it happens

Trigger: Heightmap asset's HeightType property set to an undefined/invalid value (e.g. cast from a bad import or manual .sdfloat edit), hitting the default case in DoCommandOverride.

Common situations: Hand-editing the asset file and mistyping the HeightType enum, or an asset created by a different Stride version with an incompatible enum value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/116df135d9f82213. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs:251

                                                HeightmapUtils.ConvertToByteHeights(shorts);
                                            break;

                                        case PixelFormat.R8_UNorm:
                                            bytes = HeightmapUtils.Resize(pixelBuffer.GetPixels<byte>(), pixelBufferSize, size);
                                            break;
                                    }

                                    if (useScaleToRange)
                                    {
                                        ScaleToHeightRange(bytes, byte.MinValue, byte.MaxValue, heightRange, heightScale, commandContext);
                                    }

                                    heightmap = Heightmap.Create(size, heightType, heightRange, heightScale, bytes);
                                }
                                break;

                            default:
                                throw new Exception($"{ heightType } height type is not supported.");
                        }

                        commandContext.Logger.Info($"[{Url}] Convert Image(Format={ texImage.Format }, Width={ texImage.Width }, Height={ texImage.Height }) " +
                            $"to Heightmap(HeightType={ heightType }, MinHeight={ heightRange.X }, MaxHeight={ heightRange.Y }, HeightScale={ heightScale }, Size={ size }).");
                    }
                }

                if (heightmap == null)
                {
                    throw new Exception($"Failed to compile { Url }.");
                }

                assetManager.Save(Url, heightmap);

                return Task.FromResult(ResultStatus.Successful);
            }

            private void CalculateByteOrShortRange(Vector2 heightRage, float heightScale, out float min, out float max)

View on GitHub (pinned to 96fad776d2)