Setting up Camera Functionality

The next panel we are going to work on that has some special functionality is our photo panel. Luckily, there is a great open source plugin called Native Camera available on the Unity asset store for free that handles all of the coding needed for this:

Once we have it within our asset library, we will want to add it to our project:

Once we have added it to the library, we can then take a look at the plugins folder that was added and go through the read me for instructions on how to get it working, and a link to the github for further instructions:

Within the readme, we have the code that we will need to implement into our script:

With how we plan on using this code for the picture we are taking, we don’t need to add the whole TakePicture void:

What we have done is just kept the first little bit of the code that is supplied to us, and we switched over the rest to have the texture replace that of the raw image that we have waiting to be updated. As the order of the raw image will overlap that of the picture, we don’t have to worry about deactivating our image placeholder. From here, we will also have the image be moved over to our building case file in the UIManager. As for the option to open up the camera, we are simply going to add a button to our static image for the user to be able to click on it to open up their camera:

With this all set up, we are now able to take a picture within our app. The final part is just added the logic to allow the next button to be pressed when a picture has been added and we can look towards the next part of the project.