This repository provides extension APIs listed in taichi/taichi_unity.h
in the main Taichi repository. To build this plugin you can either manually or with Visual Studio.
You need to set up environement variable TAICHI_REPO_DIR
to the root directory of Taichi. For example, if you cloned Taichi with:
cd /path/to/respositories
git clone https://github.com/taichi-dev/taichi
Then you should set TAICHI_REPO_DIR
to /path/to/respositories/taichi
.
We recommend you to build with Visual Studio for debugging.
- Open this directory in Visual Studio 2019+ with CMake Integration installed;
- Wait for auto-configuration to complete;
- Choose
taichi_unity.dll (bin/taichi_unity.dll)
in the drop-down list to the right of the green play button (▶). - Pick up your built library in
out\build\x64-Debug\bin
.
Note that if you also want to debug with symbols of taichi_c_api.dll
, you need to build Taichi with Visual Studio CMake Integration too for the best experience.
Run the following commands to build taichi_unity
without Visual Studio.
mkdir build
cd build
cmake .. -DTAICHI_C_API_INSTALL_DIR="$env:TAICHI_REPO_DIR/build"
cmake --build .
Then you will find taichi_unity.dll
in build/bin/Debug
.
Copy taichi_unity.dll
to Assets/Plugins/x86_64
of your Unity project. Language bindings (function interface and marshalling codes) can be generated with misc/generate_unity_language_binding.py
in the main Taichi repository.