Unity Package for Buttplug support in Unity 2018.2+.
Buttplug Unity contains a Intiface CLI executable, so Intiface Desktop is not required. It is still recommended that you allow users to connect out to ID somehow, though.
If you have the OpenUPM command line interface installed, then this is the fastest way to add the package to your project:
- Open your Unity project folder in a terminal like CMD or PowerShell
- Run
openupm add com.nonpolynomial.buttplug-unity
You can download and import the ButtplugUnity installer package which sets up the package reference and then removes itself.
- Download the Latest Buttplug Unity Installer Package
- In Unity, use
Assets > Import Package > Custom Package...
- Open the downloaded package.
- Click
Import
You can also manually perform the setup steps in Unity 2019+.
Add the OpenUPM registry and Buttplug Unity's scope to Project Settings:
- Go to
Edit > Project Settings > Package manager
- Click the
+
button in the registry list - Name it
OpenUPM
- Set the URL to
https://package.openupm.com
- Set the Scope to
com.nonpolynomial.buttplug-unity
- Click
Apply
Add the Buttplug Unity package in the Package Manager:
- Go to
Window > Package Manager
- Use the drop down in the upper left to select
My Registeries
- Select the
ButtplugUnity
package - Click
Install
This is a fully functional Unity project that you can clone as your own. This will mean you have the Buttplug Unity package files locally, so you'll need to manually update the package or pull latest from this project as updates are made.
- Clone
https://github.com/buttplugio/buttplug-unity
with your favorite Git client - Open root of the cloned project folder in Unity 2019.
- Open the
Example/Example.unity
scene file to run the example script.
See the Buttplug Unity example directory as well as the Buttplug Developer Guide for code and usage advice.
Note that this repo is a complete Unity project that can be opened and run in Unity.
Using Buttplug consists of the following steps:
- Setting up a connector and client
- Connecting to a server
- Scanning for devices
- Controlling devices
For the first 3 of those steps, we provide helper methods in the ButtplugUnityHelper file. See the comments in that file and the examples for usage documentation.
In Buttplug C# (which Buttplug Unity is built on), most of these are async functions, as accessing both the network and the hardware are slow functions that can block. We highly recommend executing tasks on background thread pools, as not to interrupt game actions. More examples related to this will be released soon.
An up-to-date list is kept at IOSTIndex, using the Buttplug C# filter.
When the Buttplug Unity package is loaded, it checks to see whether a StreamingAssets directory already exists. If not, it creates the directory, and under that, creates a Buttplug directory, to which it copies the Intiface CLI executable. This allows us to make sure that Unity packages the executable with your game.
As of 1.0.0, in order to make usage as work-free as possible, this functionality is automatic and there is no way to turn it off. If this affects your project in adverse ways, or if you would like to have the option to only use Intiface Desktop versus handling the binary yourself, please file an issue (or if one is already filed, add a +1 comment), and we'll try to figure out another way to do this.
By hosting hardware access externally, we minimize the impact of errors and crashes on the game process. While we certainly do our best to avoid errors, dealing with hardware can sometimes be a dynamic and challenging situation, where an extended period of normal usage can be suddenly interrupted by shit going absolutely fucked. By keeping process separation as a boundary, we can assure games that as much of the fuckery as possible stays on the Buttplug side.
Yes.
Yes, Buttplug Unity falls under the same BSD 3-Clause license as the rest of the library, meaning you just need a copyright acknowledgement in your game credits and license file. If you are interested in featuring our logos on your loading screen (which we appreciate!), please contact us on Discord or Twitter to discuss.
The Buttplug Developers are happy to consider paid support contracts. Please contact on Discord or Twitter to discuss.
- File an issue on this repo
- Join the Discord Server and ask there