https://github.com/taichi-dev/taichi-unity2
https://github.com/taichi-dev/taichi-unity2
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/taichi-dev/taichi-unity2
- Owner: taichi-dev
- License: apache-2.0
- Created: 2022-06-20T04:04:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-21T10:28:25.000Z (about 3 years ago)
- Last Synced: 2025-05-06T18:48:42.459Z (about 1 year ago)
- Language: C++
- Size: 115 KB
- Stars: 24
- Watchers: 6
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Taichi Unity Native Plugin
This repository provides extension APIs listed in `taichi/taichi_unity.h` in the [main Taichi repository](https://github.com/taichi-dev/taichi). To build this plugin you can either manually or with Visual Studio.
## Prerequisites
You need to set up environement variable `TAICHI_REPO_DIR` to the root directory of Taichi. For example, if you cloned Taichi with:
```sh
cd /path/to/respositories
git clone https://github.com/taichi-dev/taichi
```
Then you should set `TAICHI_REPO_DIR` to `/path/to/respositories/taichi`.
## Build with Visual Studio
We recommend you to build with Visual Studio for debugging.
1. Open this directory in Visual Studio 2019+ with CMake Integration installed;
2. Wait for auto-configuration to complete;
3. Choose `taichi_unity.dll (bin/taichi_unity.dll)` in the drop-down list to the right of the green play button (▶).
4. 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.
## Build with CMake
Run the following commands to build `taichi_unity` without Visual Studio.
```powershell
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`.
## Integration to Unity
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.