This codebase is currently in its AI-slob prototyping phase: the code runs on momentum, vibes, and plausible intent. Proper debugging will be introduced once demand graduates from hypothetical to measurable.
Unity plugin for nozzle GPU texture sharing.
Send and receive textures between Unity and other nozzle-compatible applications (openFrameworks, Max/MSP, TouchDesigner, etc.) on macOS and Windows. GPU-side texture copy — no CPU readback.
- NozzleSender: Publish Unity textures to the nozzle network via GPU copy
- NozzleReceiver: Subscribe to textures from nozzle senders via GPU copy
- NozzleDiscovery: Enumerate available senders at runtime
- macOS (Metal/IOSurface) and Windows (D3D11) backends
- Unity Package Manager compatible
- Unity 2021.3+
- macOS 12+ (Metal) or Windows 10+ (D3D11)
- Built nozzle native library (
libnozzle.a/nozzle.lib)
- Open Unity Package Manager (Window > Package Manager)
- Click "+" > "Add package from git URL..."
- Enter:
https://github.com/nozzle-io/nozzle.unity.git
- Clone this repository recursively:
git clone --recursive https://github.com/nozzle-io/nozzle.unity.git - Build the nozzle native library
- Place the built library in your Unity project's
Assets/Plugins/Nozzle/
git clone --recursive https://github.com/nozzle-io/nozzle.unity.git
cd nozzle.unity/nozzle
cmake -B build -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0
cmake --build build --config ReleasePlace libnozzle.a (macOS) or nozzle.lib (Windows) in your Unity project under Assets/Plugins/Nozzle/.
- Add a
NozzleSendercomponent to any GameObject - Set the sender name (used by receivers to find this sender)
- Assign a
Texture(Texture2D or RenderTexture) as the source - The texture is published every frame via GPU copy while the component is enabled
- Add a
NozzleReceivercomponent to any GameObject - Set the sender name to connect to
- A
RenderTextureis automatically created and updated each frame via GPU copy - Read
LastFrameInfofor metadata (resolution, frame index, timestamp)
- Add a
NozzleDiscoverycomponent to any GameObject - Call
Refresh()to enumerate available senders - Access
AvailableSendersfor the list of sender info
// Receive a texture and apply it to a material
var receiver = gameObject.AddComponent<Nozzle.NozzleReceiver>();
receiver.senderName = "MyOFApp";
// Later, in Update or a coroutine:
if (receiver.IsConnected && receiver.TargetTexture != null)
{
GetComponent<Renderer>().material.mainTexture = receiver.TargetTexture;
}Unity C# (MonoBehaviour) ←→ P/Invoke ←→ nozzle (C ABI — libnozzle)
The C# plugin calls nozzle's C ABI (nozzle_c.h) directly. Native texture pointers (MTLTexture* / ID3D11Texture2D*) from Unity's Texture.GetNativeTexturePtr() are passed to nozzle_sender_publish_native_texture and nozzle_frame_copy_to_native_texture for GPU-side texture copy. No intermediate C++ bridge layer.
MIT
Third-party dependencies:
- nozzle — MIT