![]() The client communicates with the server, but do not execute any server only code. Then, other players can connect to this host by as clients (by selecting LAN Client). A host works as a client and a server at the same time. Unity multiplayer games work in the following way: first, a player starts a game as host (by selecting LAN Host). In this tutorial we are going to use the LAN Host and LAN Client options. ![]() The Network Manager HUD shows a simple HUD for the players to connect to a game.įor example, if you play the game now, you should see the following screen: ![]() This object will be responsible for managing for connecting different clients in a game and synchronizing the game objects among all clients. In order to have a multiplayer game, we need a GameObject with the NetworkManager and NetworkManagerHUD components, so let’s create one. Try running the game now and you should see the space background in the game. In the BackgroundImage we only need to set the Source Image, which will be the space one. This way the Canvas will appear in the background, and not in front of the other objects. Then, we are going to set its UI Scale Mode to Scale With Screen Size. In the BackgroundCanvas, we need to set its Render Mode to be Screen Space – Camera (remember to attach your Main Camera to it). We can do that by creating a new Image in the Hierarchy, and it will automatically create a new Canvas (rename it to BackgroundCanvas). The first thing we are going to do is creating a background canvas to show a background image. You can download the tutorial source code files here. Go to the Asset Store ( Window > Asset Store) and download “Mirror”. In the Sprite Editor (shown below), you need to open the slice menu and click in the Slice button, with the slice type as automatic. In order to do that, we need to set the Sprite Mode as Multiple and open the Sprite Editor. However, some of those sprites are in spritesheets, such as the enemies spritesheets, and they need to be sliced. Unity Inspector will automatically import them to your project. In order to do that, create a folder called Sprites and copy all sprites to this folder. Before starting reading the tutorial, you need to create a new Unity project and import all sprites available through the source code.
0 Comments
Leave a Reply. |