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 README.md 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.

--

--

--

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Compile and Build WebRtc Library for Android Platform

How to Add Sticky Notes to Your Android Home Screen

Android Menu Summarized

Running containerized android tests in GCP using Pulumi and Selenoid

Dependency Injection: Easy mode

Android Basics — App Components and Activity Lifecycle

Tenth Week of Coding 9th August — 15th August

Android Architecture or Android Software Stack

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Nielsen

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

More from Medium

Journal 142 — Unity Project Development, 2.5D Shooter

Making a RTS game #48: Various fixes, improvements and clean-ups (Unity/C#)

A Series On Creating Immersive Audio in Unity with Custom Wwise Scripts

Diverging from Base Enemy Class