Annoy.NET is a C# Wrapper for Spotify's Annoy, it can be used either with Unity or your C# based Application.
- Drag & Drop
annoy.net.unitypackageinto unity editor - Profit!
using System;
using UnityEngine;
using AnnoyWrapper;
public class Test : MonoBehaviour
{
void Start()
{
IntPtr index = Annoy.Index(512, AnnoyMetric.Angular);
Annoy.AddItem(index, 0, new float[512]);
Annoy.AddItem(index, 1, new float[512]);
Annoy.AddItem(index, 2, new float[512]);
Annoy.Build(index, 10);
Debug.Log(Annoy.GetNItems(index)); // 3
Annoy.Free(index);
}}- Clone this repository
git clone https://github.com/TrainHead-software/annoy.net.git
cd annoy.net- Clone the Annoy source inside project folder
git clone https://github.com/spotify/annoy.git annoy- Build the native library using CMake (works on Windows, Linux, and other platforms):
cmake -S annoy_clang -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config ReleaseOn Linux this generates libannoy_c.so, while on Windows it produces annoy_c.dll.
- Metric_Hamming: add support to C-wrapper and P/Invoke.
- Cross-platform compatibility: builds for macOS (.dylib)
This project includes and wraps Spotify Annoy, a C++ library for approximate nearest neighbors.