# unity.rs, unreal.rs, wasm.rs — Engine Integration Bindings

#### 🎮 `unity.rs` — Unity Binding

Provides a simple bridge between Unity (C#) and the Rust agent core via FFI.

**🧩 Unity Setup**

* C# script `OxydeAgent.cs` wraps native calls via `[DllImport]`
* Unity scene listens for `.SendInput(string)` and emits output via event
* Can be used with dialogue UI, character triggers, or world events

**🔧 Key Functions**

```rust
#[no_mangle]
pub extern "C" fn agent_input(ptr: *const c_char) -> *mut c_char
```

> Input/Output via C-compatible strings\
> Memory safely managed on Rust side

***

#### 🧬 `unreal.rs` — Unreal Engine Binding

Integrates with C++/Blueprints in Unreal Engine.

**🛠️ Unreal Setup**

* C++ class `UOxydeAgentComponent`
* Binds to gameplay input/output
* Blueprint events for receiving responses

**🧩 Key API Methods**

```cpp
void SendInput(FString PlayerInput);
FString GetLastResponse();
```

> Non-blocking async supported\
> Event-driven output for seamless narrative pacing

***

#### 🌐 `wasm.rs` — WebAssembly Runtime

Enables in-browser agents using `wasm32-unknown-unknown`.

**💻 Use Cases**

* Visual novel games
* Web demos
* Agent playgrounds for experimentation

**🔗 JS Integration**

Exports `oxyde_input()` and `oxyde_response()` via `wasm-bindgen`.

```javascript
const output = await oxyde_input("What do you remember?");
```

> Load from CDN or local bundle. Persistent memory WIP.

***

#### 🔮 Future Extensions

* Multiplayer RPC support (shared memory / server)
* WebSocket bridge
* Bidirectional state sync with engine (emotion → animation)
