Skip to content

NullReferenceException when creating world in WASM compiled module #18

@l3dotdev

Description

@l3dotdev

Hi, thank you for this! Would you know why I am getting a NullRef exception when trying to create a world? The code is running inside of WASM

System.NullReferenceException: Arg_NullReferenceException
   at Box2D.NET.B2World.Clear()
   at Box2D.NET.B2Worlds.b2CreateWorld(B2WorldDef& )
   at StdbModule.Modules.World.WorldTick.CreateWorld()
private static B2WorldId CreateWorld()
{
    var def = new B2WorldDef
    {
        enableSleep = true,
        gravity = new B2Vec2(0, 0)
    };

    return B2Worlds.b2CreateWorld(ref def);
}

.NET version: 8.0.400
runtime: wasi-wasm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions