Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Bridge~/src/UnityBridge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { Room } from "livekit-client"
import { Room, setWrapperSdkInfo } from "livekit-client"
import type TypedEmitter from 'typed-emitter';
import { EventEmitter } from 'events';

// Injected by webpack from the Unity package.json
declare const __LK_UNITY_SDK_VERSION__: string;

// Report this SDK as UNITY_WEB instead of JS to the server.
// Runs when the .jspre loads, before C# can create and connect a Room.
setWrapperSdkInfo({ sdk: 'UNITY_WEB', version: __LK_UNITY_SDK_VERSION__ });

export class UnityBridge extends (EventEmitter as new () => TypedEmitter<UnityCallbacks>) {
private _ready : boolean = false;

Expand Down
8 changes: 8 additions & 0 deletions Bridge~/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require("terser-webpack-plugin");
// The Unity package, not the Bridge npm package, so the reported version matches the SDK users install
const unityPackage = require('../package.json');

module.exports = {
entry: {
Expand All @@ -15,6 +18,11 @@ module.exports = {
},
},
mode: 'production',
plugins: [
new webpack.DefinePlugin({
__LK_UNITY_SDK_VERSION__: JSON.stringify(unityPackage.version),
}),
],
devtool: 'inline-source-map',
target: ["web"],
module: {
Expand Down
Loading