Objective: Change object’s color randomly every every two seconds.
A coroutine will allow us to execute a process while other processes are being run. Coroutines are also useful when we want to delay a process. In our example, we’ll do both: Change color while the shapes are spinning, waiting 2 seconds between each change.
We’ll begin by setting our wait time (2 seconds) and caching references for the object’s MeshRenderer and a WaitForSeconds class.
Objective: Use scriptable objects to fill-out a game object template.
We’ve been tasked with creating an interactive for visitors to a zoo. When the user clicks on an area of the map, we reveal a card with animals and facts that apply to that area.
Imagine if we had 50 exhibits. Creating a page for each one would take a lot work. Luckily, we can create one template and use scriptable objects to populate it!
Our scriptable object definition is really simple: Three strings to hold the text info and a sprite to hold a picture. All of our scriptable…
Continuing from our previous article (https://lordkakabel.medium.com/saving-a-file-to-aws-26adf62e79ef), we’ll now load the file we saved to Amazon Web Services (AWS). We’ll do this by calling our GetObjectList method. This method takes-in the user-inputted case number and an Action that will trigger (if supplied).
We’ll take the user’s case number and validate it to create a proper file name. Then we’ll create a request for a list of objects in our AWS bucket.
To use Amazon Web Services (AWS), we’ll need to prepare a few things: Our region, credentials, and client. We’ll use the following variable to hold these items:
Objective: Save a object to the user’s system for later use.
The object we’d like to save is a case file. It is made up of a few strings and a photo converted into an array of bytes. (See https://medium.com/nerd-for-tech/encoding-decoding-a-picture-in-unity-82af70b36853 to learn how to convert a photo to bytes.)
Objective: Get a picture of a map of the user’s location.
To display a map, we first have to get the user’s location from their device. We’ll need to use an IEnumerator method to do so; I’ll use the Start method in this case.
First we’ll make sure the user has allowed our app to access their location.
Objective: Break a picture into an array of bytes and reassemble it.
In yesterday’s article (https://lordkakabel.medium.com/taking-a-photo-in-unity-e6e3f5328da6), we allowed the user to take a picture with their device and we stored the path to the photo within the device. Today, we’ll use that path, break the photo into a array of bytes, and reassemble it back to a photo that we can display within our app.
First, we’ll prepare an array of bytes. If we have a path to the user’s photo, we’ll store it as a Texture2D. Then we’ll EncodeToPNG to store it in the array of bytes. …
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.