Introduction to Unity - ECE-180D-WS-2023/Knowledge-Base-Wiki GitHub Wiki
By: George Beltran
Introduction
Unity is a cross platform game engine which more than 50% of the world's games were developed. It is used to develop video games for PC, consoles, mobile devices, and websites. Unity provides a user-friendly development environment for creating 2D and 3D games, with a drag-and-drop interface for adding objects, materials, and animations. It also includes a scripting API in C#, which enables developers to add complex game logic and behavior. In addition, Unity supports a large community of asset creators and developers, allowing users to easily find and incorporate 3D models, sound effects, and animations, into their games. Unity is so powerful that it also enables users to create Augmented Reality and Virtual Reality applications with the same principles as creating a normal Unity game.
Whether you are a seasoned developer or just starting out, Unity offers a powerful and flexible platform for creating games that can run on a variety of platforms, including Windows, macOS, Linux, Android, iOS, and WebGL.
Advantages and disadvantages
Advantages of Unity
Unity is a popular game development platform that offers several advantages for developers. One of the primary benefits of Unity is its cross-platform development capabilities. With just one codebase, developers can create games that can run on multiple platforms, such as PCs, consoles, mobile devices, and websites, saving both time and resources. Unity also provides a user-friendly interface that is easy for new users to navigate. Additionally, the platform has a large community of developers and asset creators who contribute to the platform, making it easy to find tutorials, assets, and solutions to common problems. Unity comes with a variety of built-in tools and features, including a physics engine, animation system, and scripting API, which eliminates the need for developers to create these components from scratch. Finally, Unity provides several monetization options for game developers, such as in-app purchases, advertising, and subscriptions, allowing developers to generate revenue from their games.
Disadvantages of Unity
Despite its numerous advantages, Unity also has some limitations and challenges that developers may encounter. One of the most significant issues is performance problems, particularly on mobile devices with limited hardware resources, resulting in slow and laggy games. Additionally, although Unity has a user-friendly interface, the underlying system can be complex, and some tasks, such as optimizing game performance, can be challenging. Another potential challenge is the cost, as advanced features and plugins can be expensive, making it difficult for small or independent game developers who have limited budgets. Finally, because Unity is a high-level game engine, it can be difficult to access and control low-level components such as memory management and threading, limiting the potential of some games and affecting performance. These factors should be taken into account when choosing a game development platform.
Overall, Unity provides a powerful and flexible platform for game development, but it may not be the best choice for all projects. It is always better to weigh the advantages and disadvantages carefully when deciding whether to use Unity for our games.
Similar platforms, advantages and disadvantages:
Unity is one of the top game engines, but in order to properly decide which platform is better for a certain project it is good to contrast and compare some of the most popular game engines. There are several close competitors to Unity in the game development market. One popular option is Unreal Engine, developed by Epic Games, which is known for its powerful suite of tools and is widely used for developing high-quality 3D games. Another option is Godot, an open-source game engine designed to be lightweight and easy to use, with strong support for 2D games. CryEngine, developed by Crytek, is known for its high-quality graphics and powerful tools, making it a great choice for visually stunning games. GameMaker Studio is another popular game engine that's easy to use, even for those with no programming experience, and has a large community of users, making it a great choice for developing 2D games. Finally, Construct is a game engine specifically designed for creating 2D games, known for its user-friendly interface and suitability for beginners and small development teams. Choosing the right game engine depends on the specific needs and goals of the game developer or team. Each of these engines has its own strengths and weaknesses, and the best choice for a particular project will depend on a variety of factors, including the type of game being developed, the level of experience, and budget.
Getting started and first tutorial:
• Install Unity: To get started with Unity, you will need to download and install the software. You can download Unity from the official website: https://unity.com/
• Start a new project: Once you have installed Unity, start a new project by clicking on the "New" button in the Project tab. Give your project a name, select a location to save it, and choose a default template (e.g. 2D or 3D).
• Create a scene: In Unity, a scene is a collection of objects that make up a level or environment in your game. To create a new scene, go to File > New Scene.
• Add objects: To add objects to your scene, you can use the Unity Editor to create and place them. For this tutorial, you can add a simple sphere to your scene by going to GameObject > 3D Object > Sphere.
• Apply materials: To apply materials to your objects, you can use the Unity Editor to select and apply materials. For this tutorial, you can apply a simple red material to your sphere by creating a new material, selecting the material in the Assets panel, and then dragging the material onto the sphere in the Scene view.
• Add a script: To add behavior to your objects, you can use scripts written in C#. For this tutorial, you can add a simple script to make the sphere rotate. To do this, you can create a new script, attach the script to the sphere, and add the following code:
using UnityEngine;
public class RotateSphere : MonoBehaviour
{
public float speed = 10.0f;
void Update()
{
transform.Rotate(0, speed * Time.deltaTime, 0);
}
}
• Play the game: To play the game and see the sphere rotate, you can press the Play button in the Unity Editor. You can also stop the game by pressing the Play button again. This is just a basic tutorial to get started with Unity. Now lets see a more game-like example.
Augmented/Virtual Reality in Unity! - By: Warren Pagsuguiron
Apart from the games we usually see, Unity takes it to the next level and allows creators to develop Augmented and Virtual Reality applications with the same format. As long as you know how to use Unity to create normal games, you already know how to create applications in AR/VR - You don't need to learn anything new to do so!
"Unity provides powerful tools to make rich, deeply engaging augmented reality experiences that intelligently interact with the real world" [4]. With tools such as AR Foundation and XR Interaction Toolkit, as well as abilities to use Unity as a library, the user has enormous power in bringing their dreams into reality (or at least augmented or virtual haha).
What is AR Foundation
As a programmer, good coding style dictates that if something is to be used over and over again that we don't copy and paste the same code over and over again. What we do instead is to create a class or function and simply peform a call to reuse that code. This is the premise of AR Foundation.
AR foundation is a framework purposely built for AR development. As a developer, we only need to create our application once and we can deploy it across multiple platforms (Apple, Android, etc). This framework gives extra features such as photorealistic rendering, physics, device optimizations, and more! [5]
Here are some features that AR Foundation provides right out-of-the-box:
In the picture above, ARCore refers to Apple and ARKit refers to Android. Remember when I said we can create application for both Apple and Android? Unity takes care of the hassle and translates your Unity project into the corresponding framework necessary for it to run on whatever platform you choose.
Click here for examples on how to use AR Foundations and it's features.
What is XR Interaction Toolkit
Sure we can place objects into our scene but without interactivity our application is boring. Boo!
With the XR Interaction Toolkit we can add interactivity to our applications by simple dragging and dropping components into place. Did you catch that? We don't need to code our interactions from scratch, saving us time and effort! [4]
The toolkit provides features such as selecting, grabbing, throwing, and many more within AR and VR scenes.
Click here for documentation and here for examples on how to use XR Interaction Toolkit and it's features.
What is Using Unity as a Library
Unity has a steep learning curve, but once you know how to use Unity to create an application, you already know how to use all the features that Unity provides and will provide. Say you already have an existing application, "instead of rebuilding your app to add AR functionality, you can use all of Unity's AR offerings by simply embedding it" [4].
This isn't simply for AR/VR, Unity allows you to tack on extra features to your mobile-apps such as 3D/2D real-time rendering, 2D mini-games, and more. By simply loading, activating, and unloading runtime libraries within the native application, you are able to control what to offer in your game.
Click here for documentation.
Conclusion
Unity is an amazing tool that provides rich features for all types of developers making it one of the global leaders in game engines. Yes, it has its disadvantages in performance and memory but as technology continues to progress we see that we have more powerful CPUs, GPUs, and higher availability of RAM. Soon enough these disadvantages will no longer hinder the platform and shoot Unity to the top like the price of Apple's Virtual Reality headset (which I imagine you can create applications for in Unity).
Whatever it is you want to create (a game, augmented, or virtual reality application), you can bet Unity offers it one-way or another. With it's native tools or asset store, the skies the limit when it comes to what you can create.
Work Cited
https://gamedevacademy.org/what-is-unity/
https://www.youtube.com/watch?v=pwZpJzpE2lQ&t=6333s
[4] https://unity.com/unity/features/ar
[5] https://unity.com/unity/features/arfoundation
[6] https://blog.unity.com/technology/xr-interaction-toolkit-preview-package-is-here