Journal 129 — Unity App Development, Add Camera Access to Take Photo

Objective: To add camera access to phone and take a photo for records

In the previous article, I added geolocation services to record the location of the user’s phone. In this article, I will add camera access to use the mobile device camera and take a photo.

We can start with a download from Unity to access the camera on IOS and Android.

After you add to your assets, you can open the Package Manager and import to the project.

From there, we want to look at the Readme file in the asset folder. Since I’m using Unity 2021, there is no need to update the AndroidManifest.xml file, unlike previous versions of Unity.

Now over at the Github repository, the includes an example script on how to implement. In our case, we don’t need to create a temporary quad. We need to create the Texture2D and assign our variable to this texture.

Here is how I implemented this.

In the Scene view, I added a Button component to the photo screen.

And now, we can see this in action.

Here is the final layout of the app.

Thank you for your time!

In the next article, I will continue with the AWS access to save the user data entered.