BurstTriangulator
v3.8.0
Search Results for

    Show / Hide Table of Contents

    Managed input support

    This package provides an extension for easily adapting managed arrays (i.e., standard C# arrays T2[]) for use as input in triangulation. To achieve this, you can use the AsNativeArrayextension. However, the user must manually release the data from the garbage collector by calling Handle.Free(). This step ensures that the garbage collector does not prematurely release memory, preventing accidental memory issues.

    using var triangulator = new Triangulator<float2>(Allocator.Persistent)
    {
        Input = new ManagedInput<float2>
        {
            Positions = new float2[] { new(0, 0), new(1, 0), new(1, 1), new(0, 1) }.AsNativeArray(out var handle)
        },
    };
    ...
    handle.Free();
    
    Note

    AsNativeArray is allocation-free. It provides native array views for triangulation without additional memory allocation.

    In this article
    Back to top Generated by DocFX | Documentation © 2024 by Andrzej Więckowski is licensed under CC BY 4.0