Unity Client
Enable seamless communication between web pages and Unity through WebSocket connections. This package provides a complete communication layer allowing web frontends to control and interact with Unity applications in real-time, complete with sample scenes and a reference web server implementation for rapid integration.
Unity Project
Built with Unity 6000.0.32f1 · download the source from GitHub
README
websocket-unity
A communication layer between a web page and Unity using WebSockets.
Install
Launch the Server
Open a terminal in the web/ directory and run:
yarn install
Launch the Webpage App
Open a second terminal in the web/ directory and start the development server:
node server.js
Launce the web frontend
yarn dev
If successful, you should see a message like this:
VITE v5.4.14 ready in 337 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
Now, open your browser and go to:
http://localhost:5173
You should see a webpage with a "Toggle Effect" button.
If the button is grayed out, the server is not running—see the "Launch the Server" section.
Unity
Open the Unity Project
- Open Unity Hub.
- Click Add → Add project from Disk.
- Locate and select the
unity-clientfolder in your project. - Once added, it should appear in your projects list—open it.
Running the Unity Client
- Open the SampleScene (if not already open).
- The scene contains two objects:
- One for handling the server connection.
- One for the visual effect.
- Press Play. If the server is running, you should see this message in the Unity Console:
Connection open! - If you don't see the message, make sure the server is running.
- Once connected, you can use the webpage to control the effect in Unity.
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In