AR and VR Apps in Unity

By Juegostudio | Virtual Reality and Augmented Reality | November 24th, 2020

How to create AR and VR apps in Unity?

Creating an application is tough. When you want to add something like Virtual Reality (VR) or Augmented Reality (AR) to your application, it becomes even more complex. However, with the right guidance and use of the right tools, you can easily create VR and AR applications.

If you’re here to learn how to easily create VR and AR apps without much hassle, we have all the useful information worthy of your attention. You can learn how you can use Unity, a cross-platform game engine, to develop VR and AR applications.

Before we begin, it’s essential to differentiate between VR and AR. They both are distinct from each other.

What is VR?

VR stands for Virtual Reality. As the name states, it takes you into a world that is not real. There are VR headsets like the Oculus Rift already in the market. It’s a goggle-like wearable device that cuts you off from your surroundings and takes you to a fantasy world.

You can view anything with a 360-degree video or even play a game with an immersive experience. Some common examples of VR games and apps are Beat Saber and Arizona sunshine. Jaunt VR, Within and Fulldive VR are some of the popular VR apps available on smartphones. Virtual Reality is already being employed by a host of industries other than gaming namely:

  • Automotive industry: Engineering and design reviews.
  • Healthcare: Training through virtual models/ Virtual reality exposure therapy.
  • Retail: Body scanning technology enabling VR shopping experience.
  • Education and training: VR smart classrooms.

What is AR?

AR stands for Augmented Reality. It’s different from Virtual Reality as it adds to the real element. Wearable glasses like Microsoft HoloLens make use of Augmented reality. Augmented reality is increasingly being employed in smartphone apps too. This is through Google’s ARCore platform mainly for android phones and AR apps on the App Store for Apple’s iPhone.

AR simply adds a digital element to what you see. For example, there’s a sofa in your living room; with AR, you can make a lion sit on your sofa. The popular game Pokémon Go uses Augmented reality to display a Pokémon on whatever your camera is focusing on.

What is Unity?

Now that you know what’s the difference between VR and AR apps, it’s time to gain some insights about Unity. Unity is one of the most famous and efficient game engines ever developed. Ranging from VR, AR, mobile console to 2D and 3D, you can create all sorts of games and apps using Unity.

Possibilities of AR And VR using Unity Platform:

Is the Unity Platform restricted to creating AR and VR based games alone? The answer is a resounding no! With the advent of platforms such as Unity, the possibilities of VR and AR can be employed in different fields such as education, health, training, and aviation to create immersive classrooms, next-generation medical training, virtual labs, and mental health simulations. The possibilities of AR and VR apps were utilized during the COVID 19 induced lockdown especially in education and healthcare using the Unity platform.

An easy tutorial to create VR and AR apps with Unity:

Although VR and AR applications are quite different, the basic procedure remains the same. It’s a basic tutorial that will walk you through the entire process of a simple VR app creation.

Setting up a virtual environment:

  • The initial ingredient for a VR application is its environment, which is only possible if you have Unity installed on your PC or MAC. You can download it from here.
  • Once you’re done downloading and installing Unity, open it to create a new project. After that, you have to add an asset to your project. You can choose any asset and add it to your Unity Project.
  • Once the file is downloaded, you’ll see a popup with an import button. Click on the import button. Now go to the Project panel and Select Window->Layouts->Default. Select and open the demoScene_free file and change the size. You can now view a scene of your asset.

Setting up the Cardboard Unity SDK:

  • You’ll see a hierarchy panel on the left. Select and delete Main Camera and First Person Controller files.
  • Download Cardboard SDK from here and unzip it. Go to the top menu bar and go to Asset->Import Package->Custom Package. Choose the package and then click on import.
  • Now, a Cardboard folder will be visible in the Project panel. Look for a subfolder with the name Prefabs and drag the file with the name Cardboard Main to drop it in the scene.
  • Now you can play and test your project. Use alt keys or your mouse trackpad to simulate the camera’s tilt.
  • While you’re not in the play mode, you can alter the position using the Transform section, which is found in Transform tools. If you need deeper insights regarding positioning elements in Unity, visit here.

Adding AutoWalk Functionality:

  • Visit here and download a script for auto walk functionality. Now you can place the file with the name Autowalk.cs into the assets folder.
  • Now click the Cardboard Main in the left panel and then click on add component. It’s present in the inspector panel present on the right look for Autowalk and selects it.
  • You’ll now see an AutoWalk section within the inspector panel. Click on the ‘Walk when triggered’ option and set speed to whatever you like. You’re done with the setting. Go into the play mode and use your mouse to trigger the Autowalk functionality.

Creating the App Package:

  • Hover to the top menu, and select go to File -> Build Settings. Click on Android and then select the ‘player settings’ Enter the required information like company name and Bundle identifier. In Resolutions and Presentation, tweak the orientation to Landscape right.
  • Select the publishing settings and enter the KeyStore. You can even create a new KeyStore if you don’t have one. Fill in the details and click on the Save button. Now, you can locate your file by selecting the browse button.
  • Find the key section and look for Alias. It’s a dropdown where you need to select the ‘Create a new key’ option.
  • If you need, you can add an app icon to your VR application. Or you can simply click on ‘Build’ in the build settings menu. Once the build is finished, you can install the application on your Android device and check its functionality.

Who can help you create an amazing VR or AR application?

The above tutorial or information is just a glimpse of how one can create a VR application using Unity. It’s cross platform capabilities, 3D analytics, and play mode features make it easy for anyone to create a VR or AR-based application using the platform.

Apart from the above, there are numerous functionalities and techniques you can employ using Unity. However, if you don’t have the time and need professionals, Juego Studios is the place to be.

Juego Studios is a full-service app/game development company where you can get amazing apps built by industry experts. You only need to state your requirements. Juego Studios employ the latest tools and technologies and deliver nothing but the best. So, reach out for an amazing experience.