Skip to content

CacheSources2D doesn't cache correctly #216

@JevinLevin

Description

@JevinLevin

May be user error, but I can't seem to fix despite copying the example scene exactly.

It collects the sources but for some reason does not cache them, despite them containing nav modifiers. This then stops me from being able to update the sources when they change position or are removed
image

I use the following code to create and update the navmesh

    private IEnumerator StartNavMesh()
    {
        if (navMeshSurface.useGeometry == NavMeshCollectGeometry.PhysicsColliders)
        {
            yield return new WaitForFixedUpdate();
        }
        navMeshSurface.BuildNavMesh();
        yield return null;
    }

    public void UpdateNavMesh(GameObject source)
    {
        cacheSources2D.RemoveSource(source);
        
        if (cacheSources2D.IsDirty)
        {
            cacheSources2D.UpdateNavMesh();
        }
    }

The surface is a tilemap with a tilemap modifier, and it uses 3D objects with modifiers to mark the non-walkable areas

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