egametang/ET · error · ArgumentException

Unsupported jump type {type}

Error message

Unsupported jump type {type}

What it means

EdgeSamplerFactory.Get builds an EdgeSampler based on a JumpLinkType bit flag. Only EDGE_JUMP_BIT and EDGE_CLIMB_DOWN_BIT are implemented; the default case (which includes EDGE_JUMP_OVER_BIT and any other value) throws ArgumentException. This is a coverage gap — not all jump link types have samplers.

Source

Thrown at Packages/cn.etetet.recast/Scripts/Core/Share/Detour.Extras/Jumplink/EdgeSamplerFactory.cs:21

namespace DotRecast.Detour.Extras.Jumplink
{
    class EdgeSamplerFactory
    {
        public EdgeSampler Get(JumpLinkBuilderConfig acfg, JumpLinkType type, JumpEdge edge)
        {
            EdgeSampler es = null;
            switch (type.Bit)
            {
                case JumpLinkType.EDGE_JUMP_BIT:
                    es = InitEdgeJumpSampler(acfg, edge);
                    break;
                case JumpLinkType.EDGE_CLIMB_DOWN_BIT:
                    es = InitClimbDownSampler(acfg, edge);
                    break;
                case JumpLinkType.EDGE_JUMP_OVER_BIT:
                default:
                    throw new ArgumentException("Unsupported jump type " + type);
            }

            return es;
        }


        private EdgeSampler InitEdgeJumpSampler(JumpLinkBuilderConfig acfg, JumpEdge edge)
        {
            EdgeSampler es = new EdgeSampler(edge, new JumpTrajectory(acfg.jumpHeight));
            es.start.height = acfg.agentClimb * 2;
            RcVec3f offset = new RcVec3f();
            Trans2d(ref offset, es.az, es.ay, new RcVec2f { x = acfg.startDistance, y = -acfg.agentClimb, });
            Vadd(ref es.start.p, edge.sp, offset);
            Vadd(ref es.start.q, edge.sq, offset);

            float dx = acfg.endDistance - 2 * acfg.agentRadius;
            float cs = acfg.cellSize;
            int nsamples = Math.Max(2, (int)Math.Ceiling(dx / cs));

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Filter the jump link types you pass to only EDGE_JUMP_BIT and EDGE_CLIMB_DOWN_BIT.
  2. If you need EDGE_JUMP_OVER, implement InitJumpOverSampler in a subclass or contribute the sampler upstream.
  3. Check type.Bit against the supported set before calling Get.

Example fix

// before
foreach (var t in allJumpTypes)
    builder.Build(acfg, t); // throws for EDGE_JUMP_OVER

// after — filter supported types
var supported = new[] { JumpLinkType.EDGE_JUMP_BIT, JumpLinkType.EDGE_CLIMB_DOWN_BIT };
foreach (var t in allJumpTypes.Where(j => supported.Contains(j.Bit)))
    builder.Build(acfg, t);
Defensive patterns

Strategy: validation

Validate before calling

var supported = new[] { JumpLinkType.EDGE_JUMP_BIT, JumpLinkType.EDGE_CLIMB_DOWN_BIT };
if (!supported.Contains(type.Bit)) { /* skip unsupported jump type */ return; }

Type guard

static bool IsSupportedJumpType(JumpLinkType t) => t.Bit == JumpLinkType.EDGE_JUMP_BIT || t.Bit == JumpLinkType.EDGE_CLIMB_DOWN_BIT;

Prevention

When it happens

Trigger: Constructing jump links with a type whose Bit is EDGE_JUMP_OVER_BIT or any value not matching the two implemented cases; iterating over all JumpLinkType flags and passing each to the factory.

Common situations: Enabling EDGE_JUMP_OVER in a JumpLinkBuilderConfig but the sampler for it was never implemented; upgrading DotRecast where the enum gained new flags but the factory did not.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/2119a371186619b6. Report an issue: GitHub.