So for starters, I have made some amazing progress since I have opened Unity and began to work in its environment, all of which will be elaborated on in due time. For this post I will be focusing on what I have achieved thus far: objects creation in the unity environment.
The picture above, shows the fruit of my labor this past week. I have succeeded in the creation of two major components of my game: 5 card objects that will be moved around the board, and the game board that they will be moving around on.
At the moment the cards are just static objects with no scripts attached to them. For each of these objects I created a 3D cube and attached an image to it**. In order to complete this process one must import an image into their unity project, and change it to a sprite. Once this new sprite has been created, it can be attached to any object in the scene by simply dragging the sprite and dropping it on the object.
I had an issue with this process originally, as I was confused on how images were attached to Unity objects. So when the interface was not allowing me to drop my .png or .jpeg image on my card object, I became frustrated. A couple hours later, after scouring the internet for answers and nearly giving up to look for another solution all together, I finally found the problem, each image that is imported into the Unity environment defaults to be a texture. Textures cannot be attached to Unity objects in the manner that I was attempting. That is where I learned how to change the image to a sprite. Since changing this one setting, everything has been golden on this front, and all of my base objects are in place.
So what I’ve learned about creating objects in unity with images is that:
- Create a 3D object
- Upload an image into the project directory
- In the unity interface, change the Texture type of the image from “Texture” to “Sprite (2D and UI)”
- In the unity interface, click and drag the image onto the desired object (either in the Scene window, or the Hierarchy window)
- Alternatively, each object has a section in their respective inspector windows that is called the Sprite Renderer. In this section of the inpsector window, you can drag the image over the text box named Sprite to get the same result as the previous method.
- Congratulations, you have created an object with a picture.
In short, this has been a train wreck of a time that has resulted in a lot of fruitful knowledge of the Unity environment.
In my next post I will be exploring my initial dive into the Unity Coding Environment, and what I have achieved on that front. Until next time.
**As a disclaimer, the images that I am currently using are from the original Triple Triad game that is copyrighted by Squaresoft (Square Enix), and will only be used for testing purposes. In the future I will be using custom made images.