I know I'm not the only one intrigued by gaming, which is one reason I like to write about building games. So far I have written articles that include information on building games for Android and Kindle Fire. This article provides an overview to the basics of Unity 4.
Unity is a game engine that provides the ability to build games that can run on a variety of platforms including XBox, PlayStation, Windows Phone, Android , Blackberry, Webplayer, PC/Unix/Mac standalone and more, as shown in the following picture.
I think it's exciting to be able to build a game once and distribute it to multiple platforms because that means developers can distribute a game more widely, which equals a much larger audience and, ultimately, more money.
Unity's core user interface includes the Project, Assets, Inspector, Hierarchy, Scene and Game windows. The following paragraphs discuss these windows in greater detail.
In Unity you create a project to build a game. When a new project is created, you select a package to import. When you import a package the assets associated with the package are automatically included as part of the project when Unity opens. Sharing assets, such as audio files, 3D buildings, player avatars (humanoids) and other files decrease development time since some GameObjects are already completed. Developers then place and use the GameObjects the way they want to within their game. For example, if you create a new project and import the Stealth package; all of the assets associated with the Stealth project will import into your new project including the 3D buildings, a 3D bus, humanoids, and more . Developers can then create a new game using one or more of the existing Stealth game assets; or even modify some of the assets before using them. Developer can then create new assets and incorporate them into the game.
In Unity, assets are files included in a project. Assets are available from the Project Browser. Unity has an Assets window that provides a way to view the assets within a folder displayed by the Project Browser window.
Note that assets may or may not be physically added to a scene. Although GameObjects are usually added to a scene. For example, audio files are assets and scripts are assets. Scripts reference GameObjects but you would not drop a script onto a game scene and expect to see the script do something.
Assets can be shared across multiple games because they are included in the game from a file that resides on your computer. Developers can buy assets, sell assets or even download free assets. Assets are available from the Asset Store at https://www.assetstore.unity3d.com/. And, developers can learn more about selling Unity assets by navigating to http://unity3d.com/asset-store/sell-assets.
The Inspector Window provides a way to manipulate GameObjects by providing access to the GameObject's components. Notice the scene window below shows a GameObject selected (a red arrow points to the GameObject). Notice the Inspector window, which is highlighted with a red box, shown in the picture below.
The Inspector window shows the components and related properties that can be manipulated to achieve a desired result. The Inspector window includes a Transform component used to indicate the position of the GameObject. The Transform component of the GameObject can also be used to scale or rotate the GameObject, as can be seen by viewing the Transform properties shown in the above picture. The following picture shows script components associated with the GameObject. Also notice a sound clip (named weapon_sciFiGun_fire) is part of the Done Enemy Shooting component and is used to bring shooting to life in the game.
In the example below, the script components were written using C#. However, developers can also use JavaScript to program games in Unity. To learn more about GameObjects read the documentation titled "GameObject" at http://docs.unity3d.com/Documentation/Manual/GameObjects.html.
Unity is a game engine that provides the ability to build games that can run on a variety of platforms including XBox, PlayStation, Windows Phone, Android , Blackberry, Webplayer, PC/Unix/Mac standalone and more, as shown in the following picture.
I think it's exciting to be able to build a game once and distribute it to multiple platforms because that means developers can distribute a game more widely, which equals a much larger audience and, ultimately, more money.
Unity Development Environment
Unity's core user interface includes the Project, Assets, Inspector, Hierarchy, Scene and Game windows. The following paragraphs discuss these windows in greater detail.
Project
In Unity you create a project to build a game. When a new project is created, you select a package to import. When you import a package the assets associated with the package are automatically included as part of the project when Unity opens. Sharing assets, such as audio files, 3D buildings, player avatars (humanoids) and other files decrease development time since some GameObjects are already completed. Developers then place and use the GameObjects the way they want to within their game. For example, if you create a new project and import the Stealth package; all of the assets associated with the Stealth project will import into your new project including the 3D buildings, a 3D bus, humanoids, and more . Developers can then create a new game using one or more of the existing Stealth game assets; or even modify some of the assets before using them. Developer can then create new assets and incorporate them into the game.
Assets
In Unity, assets are files included in a project. Assets are available from the Project Browser. Unity has an Assets window that provides a way to view the assets within a folder displayed by the Project Browser window.
Note that assets may or may not be physically added to a scene. Although GameObjects are usually added to a scene. For example, audio files are assets and scripts are assets. Scripts reference GameObjects but you would not drop a script onto a game scene and expect to see the script do something.
Assets can be shared across multiple games because they are included in the game from a file that resides on your computer. Developers can buy assets, sell assets or even download free assets. Assets are available from the Asset Store at https://www.assetstore.unity3d.com/. And, developers can learn more about selling Unity assets by navigating to http://unity3d.com/asset-store/sell-assets.
GameObjects, Components & the Inspector Window
The Inspector Window provides a way to manipulate GameObjects by providing access to the GameObject's components. Notice the scene window below shows a GameObject selected (a red arrow points to the GameObject). Notice the Inspector window, which is highlighted with a red box, shown in the picture below.
The Inspector window shows the components and related properties that can be manipulated to achieve a desired result. The Inspector window includes a Transform component used to indicate the position of the GameObject. The Transform component of the GameObject can also be used to scale or rotate the GameObject, as can be seen by viewing the Transform properties shown in the above picture. The following picture shows script components associated with the GameObject. Also notice a sound clip (named weapon_sciFiGun_fire) is part of the Done Enemy Shooting component and is used to bring shooting to life in the game.
In the example below, the script components were written using C#. However, developers can also use JavaScript to program games in Unity. To learn more about GameObjects read the documentation titled "GameObject" at http://docs.unity3d.com/Documentation/Manual/GameObjects.html.
Hierarchy
The Hierarchy window includes a list of gameobjects used to create a scene. For example, let's say you downloaded the Stealth game for Unity (https://www.assetstore.unity3d.com/#/content/7677). If you add the completed Stealth scene (called DoneStealth as shown in the following picture) to the Scene View, the Hierarchy shows all of the GameObjects used to complete the scene. It also shows parent/child relationships (as applicable) between objects. You can then click on each GameObject to view its related components in the Inspector window.
In addition, the Hierarchy window also includes a Create option. Developers use the Create menu to create GameObjects that display in a Scene. For example, a camera is added to a scene by selecting Create -> Camera.The camera is the GameObject through which players view the world built by the developer. One or more camera's are added to a scene so that players may view the entire world that makes up a scene.
In addition to Cameras additional GameObjects can be added such as spotlights, area lights, terrain, trees, or even cubes (that may be manipulated to serve as the ground a player walks on). The following picture shows the Create menu on the Hierarchy window.
Scenes
When a player plays a game, the game environment is delivered as a Scene. In Unity the Scene tab provides access to the Scene View. Through the Scene View developers can build what the user will see and the GameObjects with which the user will interact.
The toolbar (shown above) provides the tools developers use to manipulate and navigate to GameObjects. The hand tool enables developers to move around in the scene. The Translate tool (second from the left) provides a way to select GameObjects and drag them or enter values to place the object in a specific location. Developers can rotate GameObjects using the Rotate tool (third from the left); and, they can resize GameObject using the Scale tool (fourth from the left).
If you have downloaded the Stealth game for Unity you can see the Scene View in action by creating a new project (File -> New Project from within Unity) that includes the Stealth assets you downloaded.
To view the GameObjects and even the scripts used to build the game, navigate to the Done folder and locate the DoneScenes folder. Drag and drop the completed Stealth scene onto the Unity Scene view, as shown in the following picture. You can then play the game to see how it works.
Game
You can then use the Game View to run and test games in Unity. To begin you must click on the Game tab, as shown by a red circle below. You then click the Play button, as highlighted by the red arrow in the following picture, to run the game.
When the game is running it behaves as it would behave if it were built and distributed to a platform. As a developer, you can use the Game View to perform all of the actions you have programmed the game to perform. You can learn more about the Game View by reading the article located at http://docs.unity3d.com/Documentation/Manual/GameView40.html.
Using Unity to Build Facebook Games
Developers can download the Facebook SDK to use Unity to create games for Facebook. For more information about the Facebook SDK for Unity view the Unity - Facebook Developers article at https://developers.facebook.com/docs/unity/
To learn more about the Unity game engine visit http://unity3d.com/unity.