How To Apply Color To A Game Object In Unity?
3 min read
Learn how to add colors to your Game Object in Unity and build your own library of colors for Games, Applications, and AR/VR Experiences.
What are you going to learn?
Most of the time when you are using Game Objects in Unity, you would like to add some color to them so that all your Game Objects look different from each other.
In this article, I will show you a simple method to apply any color to a Cube.
This same technique can be used to- 👉 apply color to all your Game Objects 👉 build your own library of colors for your game, application, or AR/VR experience
P.S — To make it easier to understand, I will treat “material” and “color” as the same thing for the rest of this article and use it interchangeably. Just remember though, that they are not the same.
Let’s begin with a blank sample scene.
Step 1: Create a folder that contains all the colors
It’s always a good practice, to begin with creating a folder that contains all your colors or materials. This helps in creating a palette(or a collection of colors or materials) and makes it easier for you to apply the colors (or materials) in your palette to the Game Objects.
Right-click in Assets Panel > Create > Folder > Name it “Materials”
Step 2: Create a material
The next step is to create a color(or material).
Go inside Materials Folder > Right-click > Create > Material > Name it “MyColor”(or whatever you want)
Step 3: Change the albedo property of the Material
Then select the created material and check out its properties in the Inspector Panel on the right-hand side.
Change the “albedo” property to whatever color you want.
Great! Now you can create a collection of colors using the same technique.
Now we can apply the color to any Game Object.
I am going to use a cube for the demo but feel free to choose any other Game Object.
Step 4: Add a cube to the Scene
Add a cube to the scene
Step 5: Drag and drop the material into the cube
Then simply drag and drop the material that you created above onto the game object like this👇
Drag and drop the material into the cube
You can now create a set of colors for 3D applications, games, or AR/VR experiences that you develop in Unity.
There are many more things that you can do with Materials in Unity to make your Game Objects look stunning! This article is just the beginning. I will brainstorm on some more articles about Materials and what you can do to make your Game Objects stand out in Unity.😉
Enjoy👏 Rajat Kumar Gupta is teaching how to create AR/VR experiences Hey 👋 I just created a page here. You can now buy me a coffee!buymeacoffee.com
Did you find this article valuable?
Support Rajat Kumar Gupta by becoming a sponsor. Any amount is appreciated!