Nerd For Tech
Published in

Nerd For Tech

Taking a Photo in Unity

Objective: Allow the user to take a photo on their device to use in our program.

One of the great things about Unity is we don’t have to “reinvent the wheel.” There are a lot of great — even free — assets we can import and use in our projects.

Native Camera for Android & iOS by yasirkula one of these great, free assets. Simply download it from the Asset Store and import it in your project. In the README file, you’ll find a link to the project’s Github.

This link will lead you to some example code snippets. The one we are interested in is the TakePicture method.

We’ll copy and paste this into our own script and modify it for our uses. The code will check to make sure our app has permission to access the user’s camera. If we do, we’ll store the picture as a Texture2D. We’ll assign that texture to our PhotoTaken object (which is of the RawImage type) and set it to active to display the picture. We’ll also store the path to where the image is located — we’ll need this for tomorrow’s article!




NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit

Recommended from Medium


Pipeline Redemption: How Spinnaker is shaping delivery excellence at SAP

Common Challenges Faced While Converting an Angular Web Application into an Electron Desktop…

Programming for the absolute beginner

Data Structures in Python 3; Part 2

Blue Ocean’s Dashboard — Jenkins

Tau Developer Update (July 2021)

Web 3.0 and Dapps: How are they going to impact today’s Businesses

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
Ryan Sweigart

Ryan Sweigart

An independent Unity Developer.

More from Medium

What is user created content and how can you use it in your game?

Initializing Ads on the Main Menu

My journey becoming a Unity game developer: Make a game look beautiful-Creating Ceilings pt.3

Level Design in Unity Part 1: The Floor