Publish for web and mobile

Exercise

·

Beginner

·

+60XP

·

30 mins

·

Unity Technologies

Publish for web and mobile

Add mobile controls and publish your game to Unity Play.

1. Overview

Publishing a Unity project lets you share your game on different platforms, like mobile and web. Each platform has unique challenges, such as adapting controls for touchscreens and optimizing performance.

In this tutorial, you'll configure your project for WebGL and mobile so that anyone with the link can play your game on their computer, phone, or tablet. You'll integrate mobile-friendly controls, adjust build settings, create a build, and publish your game to Unity Play, Unity’s free web hosting platform.

2. Add mobile controls

When publishing a game for both desktop and mobile, you need to consider input differences. On desktop, players use a keyboard and mouse, but mobile users rely on touch controls. In this step, you'll add a MobileControlCanvas prefab, which provides an on-screen joystick and fire button for touch input. A custom script will automatically detect whether the game is running on a mobile device, then show or hide these controls accordingly.

You might have already realized that local multiplayer will not be possible on a mobile device — it would be pretty hard for two people to both control separate tanks on a single screen! There’s some code on the Player Selection screen that detects if a mobile device is being used, and if so, prevents a P2 option from being selected on the Player Selection screen.

1. Add the MobileControlCanvas prefab

  • In the Project window, open the _Tanks > Prefabs > UI folders, then drag the MobileControlCanvas prefab into the Hierarchy window.

Notice how the joystick and A button appear in the Game view. 2. Test the default mobile UI behavior

  • Enter Play mode and notice that the mobile UI elements disappear when testing in the Unity Editor, then exit Play mode.

3. Adjust the mobile UI visibility

  • In the Hierarchy window, select the MobileControlCanvas GameObject.
  • In the Mobile UI Control (Script) component, disable Auto Disable On Non Mobile Platform.
  • Enter Play mode again to test the mobile controls using your mouse.

Note: The tanks now use the Direct Control movement system, where the tanks move in the direction you drag, rather than using a fixed forward direction.4. Restore default settings

  • In the Mobile UI Control (Script) component, enable Auto Disable On Non Mobile Platform so the UI will properly hide on non-mobile devices.

Your game now includes mobile-friendly controls that dynamically appear only when needed.

3. Configure the scenes in the build

A build packages your Unity project into a playable version that can run on a specific platform. To ensure that all necessary content is included, you must select the scenes that should be part of the final build. In this step, you'll add your game scene to the Build Profile so Unity knows to include it when creating the final playable version.

1. Open the Build Profiles window:

  • From the main menu, select File > Build Profiles.
  • Alternatively, press Ctrl+Shift+B (macOS: Cmd+Shift+B).

2. Configure the scene list:

  • In the Build Profiles window, under the Platforms panel, select Scene List.
  • If there are any scenes already present in the Scene List section, select them and press the Delete key (macOS: Cmd+Delete) to remove them from the list.
  • With the Main scene open, select Add Open Scenes and your scene will now be listed in the Scene List.

Your game scene is now properly added to the build, ensuring it is included when you generate a playable version. Also, when your game loop is complete, the Main scene will be reloaded after finishing the rounds.

4. Switch to the Web platform

Unity allows you to publish a single project to many different platforms, including mobile, console, desktop, web, and more. To publish your project to the web, you first need to switch to that platform.

1. Select the Web platform

  • If the Build Profiles window is not already open, re-open it (File > Build Profiles).
  • In the Platforms list, select Web.

2. Switch platforms

  • Select the Switch Platform button and wait for the process to complete.
  • This process will take a few minutes.

Tip: If the Web platform appears grayed out, select Install with Unity Hub and install the WebGL Build Support module before switching platforms.After this process is complete, your project assets and settings are configured for deployment to the Web platform.

5. Build your project

Now that you've switched platforms, you can create a build of your project.

A build is a packaged, playable version of your game that you create when you want people to play it outside the Unity Editor.

1. Initiate the build

  • In the Build Profiles window, select the Build button.

This will open a file explorer asking you where you want to save your build. Tip: To stay organized, first, make a new folder named something like “Web Builds”, and open it.

  • Enter a name for your build, such as "[YourFirstName] Tanks build", then select Select Folder (macOS: Save).

2. Wait for your build to complete

  • This first time your project builds can take up to ten minutes. Subsequent builds will not take as long.
  • When the process is complete, the folder containing your build will appear. Keep that folder open, you’ll need it in the next step.

6. Publish to Unity Play

With your build complete, you're ready to publish it to Unity Play, allowing you to play your project online and easily share it with others.

1. Zip up your build folder

  • Locate the folder you just built ([YourFirstName] Tanks build), then compress it into a zip folder.
  • On Windows, right-click the folder and select Send to > Compressed (zipped) folder.
  • On macOS, right-click and select Compress [Folder Name].

This will create a new .zip file that you can upload to Unity Play.2. Upload your build zip file to Unity Play

  • Go to the Unity Play upload page (you’ll need to be signed in with your Unity account)
  • Drag and drop your zip file onto the upload area and wait for it to process.
  • Edit the title, description, and visibility of your project.

3. Save with mobile controlsImportant: Toggle I have added mobile controls to my game to ensure it works correctly on mobile devices.

  • Select Save to publish your game.

Your game is now live on Unity Play, making it accessible for others to play and test!

7. Test your game on different devices

Now that your game is published, it’s time to try it out! This is your chance to see how well everything works, from controls to performance, and make any final tweaks before sharing it with others.

1. Play the game on a desktop browser

  • Play your game on Unity Play, making sure movement, actions, and UI elements work as expected.

2. Test the game on a mobile device

  • Copy the game’s Unity Play link and send it to yourself via email, messaging app, or notes app.
  • Open the link on a mobile browser (such as Chrome or Safari).
  • Check that the on-screen joystick and action button appear and function correctly.

3. Fix any issues and re-publish

  • If you spot anything you want to improve, simply follow the instructions above to rebuild and re-publish your game.

The tutorial after this one will give you some ideas and guidance for adding new, fun features to your game, too.The Unity Play link remains the same, so you won’t need to resend it after updating.

Congratulations! Your game is now live and working across multiple platforms!

8. Optional: More things to try

Try these optional activities to challenge yourself, build your skills, and improve your project.Each challenge is tagged as Easy, Medium, or Expert difficulty so that you know what to expect. You can complete one, all, or none of them — it’s totally up to you. If you’re not interested in doing these challenges, mark this step as complete and proceed to the next tutorial.

Easy: Edit the splash screen

Customizing your splash screen makes your game feel more polished and unique. You can adjust colors, logos, and animations to suit your preferences.

  • Open the Build Profiles window (File > Build Profiles) and select the Player Settings button.
  • Use the foldout to expand the Splash Image section and explore settings such as the following:
  • Background Color: Adjust to match your game’s aesthetic.
  • Logos: Add or remove logos, change sequence, or adjust duration.
  • Animation: Modify the way the splash screen elements move.

Medium: Add a custom thumbnail or video

When publishing to Unity Play, replacing the default Unity logo with a custom thumbnail or video gives your project a more professional look.

  • If you’re logged in with the same Unity account that you used to upload your game, you can select the More Options menu and select Edit Game Details to make modifications.
  • Upload a custom thumbnail or video to replace the default Unity logo.
  • Capture gameplay footage using one of these methods:
  • Windows: Use the Snipping Tool for screenshots or Xbox Game Bar (Win+G) for recordings.
  • macOS: Press Cmd+Shift+5 to record a selected area or use QuickTime Player.
  • For high-quality in-game footage, you can use the Unity Recorder package:
  • Install it from the Package Manager window.

Follow the Unity Recorder documentation.

9. Your next steps

You’re officially finished with your Tanks project. Congratulations! What will you do next? Consider some of the options below:

Learn the Unity essentials

The Unity Essentials Learning pathway includes everything you need to create confidently with Unity, including the Unity interface, 3D worldbuilding, 2D workflows, Audio, and programming.

Learn the programming fundamentals

If you’re not already confident with your programming, it’s recommended that you start with the Create with Code course or the more comprehensive Junior Programmer pathway, which will take your programming skills to the next level. You can also check out the Creator Kit: Beginner Code project.

Expand your artistic design skills

You did a bit of design in this project, but there is an entire Creative Core pathway that will take you through the fundamentals of materials, visual effects, lighting, post-processing, audio, user interface design, and more.

Continue with more game development

If you want to continue down the games path, Unity Learn has a wide range of games-based learning content, including the following:

10. Share your project

If you feel proud of the game you made and you want to share it, you can upload a link to it here so other learners can see what you’ve made. You can also check out other Unity learners’ submissions below.

1. Locate the Unity Play link for your published project.

2. Add a submission title and description below, then add your Unity Play link. If you have additional details to share about your process or the project that you have created, you can share them in the description too.

3. Set who can view your submission:

  • Public: Anyone who views this tutorial.
  • Private: Just you.

4. Select Save and preview submission.

5. Check your submission preview, complete the CAPTCHA test, and select Submit and continue.

Please login to submit

Submission Gallery

Play

L
Laurie
0
0
0

Play

Tanks!

Tanks!

Unity Learn Tanks Project

J
jazzhuntan
2
16
0

Play

FIIIIIIIREEEEEE

FIIIIIIIREEEEEE

Tank simple video game

A
andryhenintsoa
2
26
0

Play

Tanks! My first 3d arcade game

Tanks! My first 3d arcade game

Version 1.0

S
SpaceZhenya
59
112
1

Play

Tanks

Tanks

Following the official Unity Tanks course to learn game development step-by-step. Building a complete tank battle game from an empty scene, exploring Unity basics and gameplay mechanics.

R
Rbt-Ghost
19
73
0

Play

Mars Brawl

Mars Brawl

⚠Note: 2 players are currently unsupported on mobile For Desktop: 1st player uses the WASD keys to move and the space key to shoot. 2nd player uses the Arrow keys to move and the enter key to shoot.

I
ibrahimsemab
16
51
1

Play

Tanks_2025_GS

Tanks_2025_GS

Play my game and win!

S
sergey2054unity
3
32
0

Play

Tanks

Tanks

I have the pause menu and the moon map have fun enjoying my new game

M
Mr_Domination
19
73
1