Tuesday, August 17, 2021

How to apply texture on an object

Hello friends , today we will see how we can apply any desired texture on an object.

Here I will take some objects and apply different type of texture on to them.

So first place your Object into the game scene like below.(Here I have taken 3D objects like cube, sphere, Capsule and cylinder)


Now we can download Texture Images from the google which we want to apply on to these object.

see below how we can do this:


Download any one image and go to unity create one folder named as Image and import that image to this folder.

new create one material you can give any name to this i will say this wooden_texture.

Select this material and lock it from the inspector then drag the downloaded images to the material albedo, see below:



After doing this you can unlock the material, and you will see your material will get a texture of your image.

To make it more perfect change the shader (see top of the inspector) from standard to Unlit/texture.


now you can drag and drop the material to the object to apply the texture to the object ,

see below:


In the above image you can see we have successfully applied the wooden texture on to our cube object.

similarly I have applied fire, sky , and wall texture to the objects .

see how it looks after applying the texture on to to objects.



now I will tell you the simplest way to apply a texture onto object ,

simply drag your texture image onto the object and you will see automatically one material folder will be created and inside that folder your image texture material will be present.


I have attached a rotate script to all objects see how it looks:



Used Rotate Script:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class Rotate : MonoBehaviour

{

    public float speed = 15.0f;

    void Update()

    {

        transform.Rotate(0, 1*Time.deltaTime*speed, 0);

    }

}