netgo-unity-client is a unity client SDK for netgo,it is easy to use and contains a demo on how to use it.
Start the Demo
- Unity 2018.4.2f1
- MacOS Catalina
- Android Mobile Phone
Build the APK for Android
Open the DemoLobbyScene and configure the netgo server IP address and port.
Switch the Platform to Android.
Click Build to generate the APK.
netgo-unity-client can also be run on MacOS/IOS/Windows.
Run and Operate
You should install and run the APK on more than one clients.Look at the lobby scene menu:
- Room Name : Define a unique name for a Room.
- Room Capacity : The count which one Room can hold.
- Join Or Create Room: If the Room exists , then join the Room ,else create a new Room.
- Create Room: Just create the Room.
- Join Room: Just join the Room.
When a client first join a room, a cube will be instantiated(Here we call Mine Cube).The Mine Cube will be cloned(Here we call Clone Cube) on other client when the other one join the same room.You can click the Mine Cube to change the colors,it can be synced by using RPC:
And then we click Move button to let the two cubes move.We here use View Sync to sync the positions and rotations for each other:
When you click the Clone Cube,we here use Custom Event to send a message to Mine Cube.
For details you can review the revelant souce codes.