Unity Page update date : Tuesday, October 31, 2023 Page creation date : Wednesday, March 30, 2022 We've published a development tips for Unity, a game engine that many developers use to create games. In-page links introduction Editor settings Game Release system UI (user interface) User input Sprite (2D) scene sound effect BGM prefab Maps (2D) Collision Handling (2D) texture file Localization (multilingual) introduction About Unity Tips This section describes the specifications and rules for Unity Tips posted on this site. Saturday, July 29, 2023 About Unity A brief description of Unity where you can do game development. Saturday, July 29, 2023 Create a Unity Account You'll need to create an account to develop with Unity. We'll walk you through the steps. Saturday, July 29, 2023 Download and install Unity Install Unity so you can use Unity as your development environment. Saturday, July 29, 2023 Create a Unity project Create a project to actually develop the game. Saturday, July 29, 2023 Get started with the sample project (3D Sample Scene HDRP) Let's create a sample project and run it to visualize how the game works. Saturday, July 29, 2023 Get started with the tutorial example project (2D Platformer Microgame) Let's create a sample project and run it to visualize how the game works. Saturday, July 29, 2023 Editor settings Edit codeChange editor Learn how to change the script editor that launches when you try to edit code from the Unity Editor. Thursday, June 29, 2023 Make Japanese the Unity Editor The Unity Editor is initially written in English, so we will Japanese it. Thursday, June 29, 2023 Game Release Output a game for Windows Provides step-by-step instructions for outputting a game created with Unity to a format that can run on Windows. Friday, September 29, 2023 Use IL2CPP to precompile a game for Windows By using IL2CPP, it is compiled to native code in advance to improve performance and security. Friday, September 29, 2023 Output a web-optimized (WebGL) game Provides step-by-step instructions for outputting a game created with Unity to a format that can be run in a web browser. Friday, September 29, 2023 Running Unity WebGL with ASP.NET Core Learn how to output a game made with Unity in WebGL and run it on a site running ASP.NET Core. Friday, September 29, 2023 system Change the game resolution Learn how to set the resolution when you start the game and how to change the resolution during gameplay. Tuesday, October 31, 2023 Switch between windowed and full-screen mode Learn how to switch between windowed and full-screen mode while the game is running. Tuesday, October 31, 2023 Run the game even when the window is inactive Initially, the game pauses when a window, including the Unity Editor, is in an inactive state. Learn how to do this so that the window works even when it is inactive. Tuesday, October 31, 2023 Exit the game Describes how to programmatically exit the game. Tuesday, October 31, 2023 UI (user interface) カメラ(2D)とキャンバスを合わせる 初期状態では UI を配置するキャンバスの表示領域とゲームを表示するカメラ(2D)の表示領域が別々なのでそれを合わせます。 Thursday, January 27, 2022 Unity UI のボタンを使用する ボタンはユーザーがメニューなどで選択肢としてクリックしてもらうために使うこともできます。またデバッグやテストでも活用できます。 Thursday, March 24, 2022 Unity UI のドロップダウンを使用する ドロップダウンを使用することにより多数の選択項目を省スペースに配置して選択させることができます。 Thursday, March 24, 2022 ドロップダウンアイテムの一覧を表示したときに選択しているアイテムが先頭にくるようにスクロールする ドロップダウンアイテムの一覧を表示したとき選択アイテムの位置に関わらず一番上のアイテムが表示されます。これを選択しているアイテムが先頭にくるように表示する方法について説明します。 Thursday, March 24, 2022 UI オブジェクトからフォーカスが外れないようにする 通常 UI オブジェクト以外をクリックするとフォーカスが外れてしまいますが、疑似的にフォーカスが外れないように対応します。 Thursday, March 24, 2022 どのプラットフォームでも同じフォントを使用できるようにする 動作するプラットフォームごとに使用できるフォントは異なりますがどの環境でも同じフォントが使用できるようにする方法について説明します。 Thursday, March 24, 2022 WebGL で日本語を入力できるようにする 入力フィールドを配置したプログラムを WebGL で公開した際、直接日本語を入力することができないためその対処法を実装します。 Thursday, March 24, 2022 UI オブジェクトの選択をループさせる オブジェクトの通常配置では入力した方向にあるオブジェクトしか選択できませんが、ここでは下を入力したときに反対側にある上のオブジェクトを選択できるようにしています。 Thursday, March 24, 2022 ボタンの選択をアニメーションさせて分かりやすくする ボタンを選択したときにボタンを大きくさせて見た目的に分かりやすくします。 Thursday, March 24, 2022 User input Introducing the Input System Package To accept input from the user, Unity has an "Input Manager" that dates back to the early days, but it is set up to use the new "Input System Package" introduced in the middle of the version. Thursday, June 29, 2023 Operating with the Keyboard (Input System Package Version) Describes how to control a game with the keyboard. Saturday, July 29, 2023 Operating with the mouse (Input System Package Version) Learn how to control your game with the mouse. Saturday, July 29, 2023 Controlling with a Gamepad (Input System Package Version) Learn how to control your game with a gamepad. Thursday, June 29, 2023 Manage multiple gamepads You can handle several gamepads at the same time. It can be used in situations where multiple people play such as local multiplayer. Thursday, June 29, 2023 Operation with a joystick (Input System packaged version) Learn how to control the game with a joystick. Tuesday, October 31, 2023 Use action maps to assign buttons to game behaviors You can use action maps, for example, to assign controller buttons to actions such as movement and jumping. Thursday, June 29, 2023 Set up an action map dynamically This section describes how to dynamically set an action map when you want to freely assign keys and buttons, such as key config. Thursday, June 29, 2023 Use touch-optimized input controls with On-Screen Control The input system package has On-Screen Control, a mechanism for input operations on touch-optimized devices. Saturday, July 29, 2023 Customize the On-Screen Control to implement the D-pad On-Screen Control can be customized on your own. Let's implement a different D-pad than stick input. Saturday, July 29, 2023 Sprite (2D) Displaying sprites (images) This section describes how to display sprites (images) on the game screen. It's easy because you can only display images on the Unity Editor. Tuesday, October 31, 2023 Move, rotate, and scale sprites Let's move the sprite with the keyboard as if you were moving the character in a game. Tuesday, October 31, 2023 Implement sprite sheet animations Let's create a sprite animation that can switch between multiple images in a row and make it look as if the picture is moving. Tuesday, October 31, 2023 Change the sprite image while the game is running When you're playing a game, you'll probably see that the image of the sprite changes frequently. This section describes how to change the image of a sprite while the game is running. Tuesday, October 31, 2023 Implement a walking animation for a 4-way sprite character Let's implement an animation in which the character walks while moving in four directions in the overhead viewpoint field, which is common in RPGs. Tuesday, October 31, 2023 Implement 8-way sprite character walking animation Let's implement an animation in which the character walks while moving in 8 directions in the overhead view field, which is common in RPGs. Tuesday, October 31, 2023 scene Switch between scenes Implements scene transitions such as transitions from the start scene to the gameplay scene, which is common in games. Friday, September 29, 2023 Add a scene Describes how to add another scene to the current scene and display it at the same time. Friday, September 29, 2023 Change the background color of a scene Describes how to change the background color of a scene. Friday, September 29, 2023 sound effect Play, pause, or stop a single sound effect This section describes how to play, pause, and stop sound effects at any time. Friday, September 29, 2023 Play multiple sounds at the same time AudioSource alone could only play a single sound, but you can use AudioClip to play multiple sounds at the same time with a single piece of audio data. Friday, September 29, 2023 Control the number of simultaneous sound effects played PlayOneShot allows you to layer sounds, but they tend to be louder because they don't have an upper limit. This time, I will try to control the number of simultaneous playback so that the volume does not become too loud. Friday, September 29, 2023 BGM Play, pause, stop, and loop background music This section describes how to play, pause, stop, and loop background music. Wednesday, August 30, 2023 Loop background music with intro Some BGM loops play the intro part only once and the loop starts in the middle. In this article, we'll try to do that in Unity. Wednesday, August 30, 2023 prefab Create Prefabs to manage a large number of objects Objects can be duplicated and placed, but if you want to change the settings, you must change as many duplicates as you want. If you use a prefab, you can manage it collectively as a copy source setting. Friday, September 29, 2023 Create an object based on a Prefab from a script We were able to place objects from the prefab in the initial placement, but I think there are cases where you want to place additional objects during the game. Here I would like to place an object from the prefab by script. Friday, September 29, 2023 Maps (2D) Create a top-down 2D map using standard Unity tilemaps Let's create a top-down 2D map like a 2D RPG with Unity's standard feature of tilemaps. Wednesday, August 30, 2023 Use 2D Tilemap Extras to create maps with autotiles It is troublesome to find and place combinations every time when placing maptips that connect up, down, left and right. Let's use auto tiles to automatically connect maptips. Wednesday, August 30, 2023 Use 2D Tilemap Extras to create animated tiles RPG tile maps may use expressions that show movement by switching map chips, such as the flow of a waterfall or the movement of waves. Here, we will try to realize that animation. Wednesday, August 30, 2023 Use 2D Tilemap Extras to create maps with animated autotiles Try creating a map with animated auto tiles by combining auto tiles and animated tiles. Wednesday, August 30, 2023 Implement hit detection with tilemaps Implements a process that prevents objects from colliding with and overlapping with the tilemap when they are moved. Wednesday, August 30, 2023 Implement hit detection for each type of MapChip Hit judgment is performed for the specified type of maptip from among the laid mapchips. Wednesday, August 30, 2023 Collision Handling (2D) Determine if objects collide with each other (2D) This section describes how to implement the collision detection necessary for bullets that are common in games to hit characters, characters to each other, etc. Thursday, June 29, 2023 Collision Handling with Standard Physics (2D) For example, when a player character hits another character, it pushes the opponent and leaves it to the physics of the Unity standard function. Thursday, June 29, 2023 texture Use render textures to display the contents of another scene as textures If you want to display a different scene, for example, on a display in your game, you can use a render texture. Friday, September 29, 2023 file Use PlayerPrefs to read and write data Use PlayerPrefs to save and load play data, settings, and more. Thursday, June 29, 2023 Write data to Unity's recommended folder path specified by persistentDataPath You can save your game's configuration data to any location, but for now we'll use persistentDataPath to save it to Unity's recommended folder path. Thursday, June 29, 2023 Localization (multilingual) Switching the text of a text object to match the environment in which the text is multilingually supported In order for your game to be played not only in Japan but also overseas, it is necessary to localize the entire game so that people in that country can play it. Here, the text object placed as one of them is multilingual. Wednesday, August 30, 2023 Switch images from image objects to match country or language Localization can be done not only for text but also for images. This toggle is useful if you have images that vary by country or culture, or if you are imaging text. Saturday, July 29, 2023 Change locale at any time The official Unity package Localization automatically sets the locale according to the parameters and environment when the game starts, but we will explain how to change the locale at any time, such as when you want to change the display language during the game. Saturday, July 29, 2023 Get a list of locales that you've created Describes how to retrieve the list of locales created by the Localization package. This is useful when you want users to select from a list. Wednesday, August 30, 2023 Get localized text and assets at any time This section describes how to retrieve localized text programmatically at any timing instead of automatically switching it in the UI. Saturday, July 29, 2023
About Unity Tips This section describes the specifications and rules for Unity Tips posted on this site. Saturday, July 29, 2023
Create a Unity Account You'll need to create an account to develop with Unity. We'll walk you through the steps. Saturday, July 29, 2023
Download and install Unity Install Unity so you can use Unity as your development environment. Saturday, July 29, 2023
Get started with the sample project (3D Sample Scene HDRP) Let's create a sample project and run it to visualize how the game works. Saturday, July 29, 2023
Get started with the tutorial example project (2D Platformer Microgame) Let's create a sample project and run it to visualize how the game works. Saturday, July 29, 2023
Edit codeChange editor Learn how to change the script editor that launches when you try to edit code from the Unity Editor. Thursday, June 29, 2023
Make Japanese the Unity Editor The Unity Editor is initially written in English, so we will Japanese it. Thursday, June 29, 2023
Output a game for Windows Provides step-by-step instructions for outputting a game created with Unity to a format that can run on Windows. Friday, September 29, 2023
Use IL2CPP to precompile a game for Windows By using IL2CPP, it is compiled to native code in advance to improve performance and security. Friday, September 29, 2023
Output a web-optimized (WebGL) game Provides step-by-step instructions for outputting a game created with Unity to a format that can be run in a web browser. Friday, September 29, 2023
Running Unity WebGL with ASP.NET Core Learn how to output a game made with Unity in WebGL and run it on a site running ASP.NET Core. Friday, September 29, 2023
Change the game resolution Learn how to set the resolution when you start the game and how to change the resolution during gameplay. Tuesday, October 31, 2023
Switch between windowed and full-screen mode Learn how to switch between windowed and full-screen mode while the game is running. Tuesday, October 31, 2023
Run the game even when the window is inactive Initially, the game pauses when a window, including the Unity Editor, is in an inactive state. Learn how to do this so that the window works even when it is inactive. Tuesday, October 31, 2023
カメラ(2D)とキャンバスを合わせる 初期状態では UI を配置するキャンバスの表示領域とゲームを表示するカメラ(2D)の表示領域が別々なのでそれを合わせます。 Thursday, January 27, 2022
Unity UI のボタンを使用する ボタンはユーザーがメニューなどで選択肢としてクリックしてもらうために使うこともできます。またデバッグやテストでも活用できます。 Thursday, March 24, 2022
ドロップダウンアイテムの一覧を表示したときに選択しているアイテムが先頭にくるようにスクロールする ドロップダウンアイテムの一覧を表示したとき選択アイテムの位置に関わらず一番上のアイテムが表示されます。これを選択しているアイテムが先頭にくるように表示する方法について説明します。 Thursday, March 24, 2022
UI オブジェクトからフォーカスが外れないようにする 通常 UI オブジェクト以外をクリックするとフォーカスが外れてしまいますが、疑似的にフォーカスが外れないように対応します。 Thursday, March 24, 2022
どのプラットフォームでも同じフォントを使用できるようにする 動作するプラットフォームごとに使用できるフォントは異なりますがどの環境でも同じフォントが使用できるようにする方法について説明します。 Thursday, March 24, 2022
WebGL で日本語を入力できるようにする 入力フィールドを配置したプログラムを WebGL で公開した際、直接日本語を入力することができないためその対処法を実装します。 Thursday, March 24, 2022
UI オブジェクトの選択をループさせる オブジェクトの通常配置では入力した方向にあるオブジェクトしか選択できませんが、ここでは下を入力したときに反対側にある上のオブジェクトを選択できるようにしています。 Thursday, March 24, 2022
Introducing the Input System Package To accept input from the user, Unity has an "Input Manager" that dates back to the early days, but it is set up to use the new "Input System Package" introduced in the middle of the version. Thursday, June 29, 2023
Operating with the Keyboard (Input System Package Version) Describes how to control a game with the keyboard. Saturday, July 29, 2023
Operating with the mouse (Input System Package Version) Learn how to control your game with the mouse. Saturday, July 29, 2023
Controlling with a Gamepad (Input System Package Version) Learn how to control your game with a gamepad. Thursday, June 29, 2023
Manage multiple gamepads You can handle several gamepads at the same time. It can be used in situations where multiple people play such as local multiplayer. Thursday, June 29, 2023
Operation with a joystick (Input System packaged version) Learn how to control the game with a joystick. Tuesday, October 31, 2023
Use action maps to assign buttons to game behaviors You can use action maps, for example, to assign controller buttons to actions such as movement and jumping. Thursday, June 29, 2023
Set up an action map dynamically This section describes how to dynamically set an action map when you want to freely assign keys and buttons, such as key config. Thursday, June 29, 2023
Use touch-optimized input controls with On-Screen Control The input system package has On-Screen Control, a mechanism for input operations on touch-optimized devices. Saturday, July 29, 2023
Customize the On-Screen Control to implement the D-pad On-Screen Control can be customized on your own. Let's implement a different D-pad than stick input. Saturday, July 29, 2023
Displaying sprites (images) This section describes how to display sprites (images) on the game screen. It's easy because you can only display images on the Unity Editor. Tuesday, October 31, 2023
Move, rotate, and scale sprites Let's move the sprite with the keyboard as if you were moving the character in a game. Tuesday, October 31, 2023
Implement sprite sheet animations Let's create a sprite animation that can switch between multiple images in a row and make it look as if the picture is moving. Tuesday, October 31, 2023
Change the sprite image while the game is running When you're playing a game, you'll probably see that the image of the sprite changes frequently. This section describes how to change the image of a sprite while the game is running. Tuesday, October 31, 2023
Implement a walking animation for a 4-way sprite character Let's implement an animation in which the character walks while moving in four directions in the overhead viewpoint field, which is common in RPGs. Tuesday, October 31, 2023
Implement 8-way sprite character walking animation Let's implement an animation in which the character walks while moving in 8 directions in the overhead view field, which is common in RPGs. Tuesday, October 31, 2023
Switch between scenes Implements scene transitions such as transitions from the start scene to the gameplay scene, which is common in games. Friday, September 29, 2023
Add a scene Describes how to add another scene to the current scene and display it at the same time. Friday, September 29, 2023
Change the background color of a scene Describes how to change the background color of a scene. Friday, September 29, 2023
Play, pause, or stop a single sound effect This section describes how to play, pause, and stop sound effects at any time. Friday, September 29, 2023
Play multiple sounds at the same time AudioSource alone could only play a single sound, but you can use AudioClip to play multiple sounds at the same time with a single piece of audio data. Friday, September 29, 2023
Control the number of simultaneous sound effects played PlayOneShot allows you to layer sounds, but they tend to be louder because they don't have an upper limit. This time, I will try to control the number of simultaneous playback so that the volume does not become too loud. Friday, September 29, 2023
Play, pause, stop, and loop background music This section describes how to play, pause, stop, and loop background music. Wednesday, August 30, 2023
Loop background music with intro Some BGM loops play the intro part only once and the loop starts in the middle. In this article, we'll try to do that in Unity. Wednesday, August 30, 2023
Create Prefabs to manage a large number of objects Objects can be duplicated and placed, but if you want to change the settings, you must change as many duplicates as you want. If you use a prefab, you can manage it collectively as a copy source setting. Friday, September 29, 2023
Create an object based on a Prefab from a script We were able to place objects from the prefab in the initial placement, but I think there are cases where you want to place additional objects during the game. Here I would like to place an object from the prefab by script. Friday, September 29, 2023
Create a top-down 2D map using standard Unity tilemaps Let's create a top-down 2D map like a 2D RPG with Unity's standard feature of tilemaps. Wednesday, August 30, 2023
Use 2D Tilemap Extras to create maps with autotiles It is troublesome to find and place combinations every time when placing maptips that connect up, down, left and right. Let's use auto tiles to automatically connect maptips. Wednesday, August 30, 2023
Use 2D Tilemap Extras to create animated tiles RPG tile maps may use expressions that show movement by switching map chips, such as the flow of a waterfall or the movement of waves. Here, we will try to realize that animation. Wednesday, August 30, 2023
Use 2D Tilemap Extras to create maps with animated autotiles Try creating a map with animated auto tiles by combining auto tiles and animated tiles. Wednesday, August 30, 2023
Implement hit detection with tilemaps Implements a process that prevents objects from colliding with and overlapping with the tilemap when they are moved. Wednesday, August 30, 2023
Implement hit detection for each type of MapChip Hit judgment is performed for the specified type of maptip from among the laid mapchips. Wednesday, August 30, 2023
Determine if objects collide with each other (2D) This section describes how to implement the collision detection necessary for bullets that are common in games to hit characters, characters to each other, etc. Thursday, June 29, 2023
Collision Handling with Standard Physics (2D) For example, when a player character hits another character, it pushes the opponent and leaves it to the physics of the Unity standard function. Thursday, June 29, 2023
Use render textures to display the contents of another scene as textures If you want to display a different scene, for example, on a display in your game, you can use a render texture. Friday, September 29, 2023
Use PlayerPrefs to read and write data Use PlayerPrefs to save and load play data, settings, and more. Thursday, June 29, 2023
Write data to Unity's recommended folder path specified by persistentDataPath You can save your game's configuration data to any location, but for now we'll use persistentDataPath to save it to Unity's recommended folder path. Thursday, June 29, 2023
Switching the text of a text object to match the environment in which the text is multilingually supported In order for your game to be played not only in Japan but also overseas, it is necessary to localize the entire game so that people in that country can play it. Here, the text object placed as one of them is multilingual. Wednesday, August 30, 2023
Switch images from image objects to match country or language Localization can be done not only for text but also for images. This toggle is useful if you have images that vary by country or culture, or if you are imaging text. Saturday, July 29, 2023
Change locale at any time The official Unity package Localization automatically sets the locale according to the parameters and environment when the game starts, but we will explain how to change the locale at any time, such as when you want to change the display language during the game. Saturday, July 29, 2023
Get a list of locales that you've created Describes how to retrieve the list of locales created by the Localization package. This is useful when you want users to select from a list. Wednesday, August 30, 2023
Get localized text and assets at any time This section describes how to retrieve localized text programmatically at any timing instead of automatically switching it in the UI. Saturday, July 29, 2023