Saving & Loading Data in Unity
Let’s start taking a look at how we can reconstruct our photo back into the overview panel and get a file location for the case we have just created. To start we are going to have to make some adjustments to some of our scripts:
What we have done with the UIManager script is to create a log of all the changes to the different aspects of the case. From here, we will create a binary formatter to allow us to save all the information to the hard disk so that we can start the process to upload it to AWS. Once we have all the information set in place, we will be sure to close the file off once we have slicked the submit button, and just so we know, we will create a log to let us know where it is being saved. Next, let’s take a look at what we will alter within the photo panel:
What we are doing here is adjusting our process info to create an imgPath for the photo that was taken. This will make it possible for us to pull that location on the overview panel to have us view the picture there. Finally, let’s take a look at how we are going to make some adjustments to our overview panel:
Here what we are going is just pulling all of the information from the UIManager that we had saved from previous panels. As for the photo, we have to restructure it as a new texture2D and load the image as a texture of the reconstructed image.
With all of this out of the way, let’s take a look to see if it all connects within our create a case process, and check to see if it tells us where exactly we have our files saved at:
Now that we have all of the information set up and being transferred over to our overview panel and showing the location to where our case has been saved, we can now start to look at how we can go about setting up the connection with AWS and being able to use the cloud service.