From eb500d64825f0cdcf80ddaa42630a023df7dadb8 Mon Sep 17 00:00:00 2001 From: Wanpeng Li Date: Thu, 30 May 2024 14:11:11 +0800 Subject: [PATCH 1/2] add vr sample --- samples/csharp/Readme.md | 2 ++ .../unity-multiplayer-VR-sample/Readme.md | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 samples/csharp/unity-multiplayer-VR-sample/Readme.md diff --git a/samples/csharp/Readme.md b/samples/csharp/Readme.md index 80f573a59..4e8160332 100644 --- a/samples/csharp/Readme.md +++ b/samples/csharp/Readme.md @@ -5,3 +5,5 @@ * [A simple chat demo using Microsoft Entra authentication](./chatapp-microsoft-entra-id) * [A client-only publish/subscribe messages using WebSocket subprotocol](./clientpubsub) * [A log streaming sample using the WebSocket subprotocol](./logstream) +* [A unity multiplayer sample](./unity-multiplayer-sample/) +* [A unity Multiplayer VR sample](./unity-multiplayer-VR-sample/) diff --git a/samples/csharp/unity-multiplayer-VR-sample/Readme.md b/samples/csharp/unity-multiplayer-VR-sample/Readme.md new file mode 100644 index 000000000..801052080 --- /dev/null +++ b/samples/csharp/unity-multiplayer-VR-sample/Readme.md @@ -0,0 +1,34 @@ +# Unity Multiplayer VR Sample + +his sample show off how to use [Azure Realtime Transport for Unity](https://github.com/wanlwanl/multiplayer-community-contributions/tree/wanl/transport/Transports/com.community.netcode.transport.azure-realtime) in VR game. + +> This project is based on Meta Oculus's [Unity-UltimateGloveBall](https://github.com/oculus-samples/Unity-UltimateGloveBall) sample, please try to setup and run it first. + +## Additional Setup + +### A. Setup Dev Negotiate Server + +1. Copy connection string in `Keys` page of your Web PubSub service you just created. +2. Install [dotnet runtime](https://learn.microsoft.com/dotnet/core/install/) if you don't have one. +3. In `Proejct` view, right click `Packages/Azure Web PubSub Transport for Netcode for Gameobjects`, and click `Show in Explorer`. +4. Extact `Resources/NegotiateServersSource~.zip` and go into the extracted folder `NegotiateServersSource~/AWPSNegotiateServer`, rename `appseetings.sample.json` to `appsettings.json `, fill the connection string in `ConnectionString` section. +5. In terminal app, run `dotnet run` to start negotiation server. +6. Get listening URL in console log. For example: `Now listening on: https://localhost:7172` + +### B. Setup Transport + +1. Download latest `azure-webpubsub-transport.unitypackage`package from `[Releases](https://github.com/albertxavier100/azure-web-pubsub-transport/releases)`. +2. Import `azure-webpubsub-transport.unitypackage` to your Unity project. +3. Add `AzureWebPubSubTransport` component to your GameObject containing your NetworkManager. +4. Set the `Network Transport` field on the NetworkManager to the `AzureWebPubSubTransport`. +5. Enter a room name into the `Room Name` field of the `AzureWebPubSubTransport`. +6. Enter negotiate endpoint. For example, `https://localhost:7172/negotiate` if you use the builtin developing negotiate server. +7. Use the `StartServer`, `StartHost` and `StartClient` functions as usually to host a game and have clients connect to it. + +> At this point, you should be able to exchanges data between unity server and client. + +## Next Step + +For video tutorial, check out [From 0 to Unity Multiplayer Hero: 9 Steps Using Azure Web PubSub](https://www.youtube.com/watch?v=-0LlnojcMCs). +For more details, see [azure-web-pubsub-transport](https://github.com/albertxavier100/azure-web-pubsub-transport) + From 7150a5b5a43b7b08ac12399157e1edf6bd8f1330 Mon Sep 17 00:00:00 2001 From: Wanpeng Li Date: Thu, 30 May 2024 14:16:06 +0800 Subject: [PATCH 2/2] typo --- samples/csharp/unity-multiplayer-VR-sample/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/csharp/unity-multiplayer-VR-sample/Readme.md b/samples/csharp/unity-multiplayer-VR-sample/Readme.md index 801052080..429cc9b94 100644 --- a/samples/csharp/unity-multiplayer-VR-sample/Readme.md +++ b/samples/csharp/unity-multiplayer-VR-sample/Readme.md @@ -11,7 +11,7 @@ his sample show off how to use [Azure Realtime Transport for Unity](https://gith 1. Copy connection string in `Keys` page of your Web PubSub service you just created. 2. Install [dotnet runtime](https://learn.microsoft.com/dotnet/core/install/) if you don't have one. 3. In `Proejct` view, right click `Packages/Azure Web PubSub Transport for Netcode for Gameobjects`, and click `Show in Explorer`. -4. Extact `Resources/NegotiateServersSource~.zip` and go into the extracted folder `NegotiateServersSource~/AWPSNegotiateServer`, rename `appseetings.sample.json` to `appsettings.json `, fill the connection string in `ConnectionString` section. +4. Extact `Resources/NegotiateServersSource~.zip` and go into the extracted folder `NegotiateServersSource~/AWPSNegotiateServer`, rename `appsettings.sample.json` to `appsettings.json `, fill the connection string in `ConnectionString` section. 5. In terminal app, run `dotnet run` to start negotiation server. 6. Get listening URL in console log. For example: `Now listening on: https://localhost:7172`