How to make the cube decrease by texture?

Im not good at java but is dont get it :frowning:

heres the script im working on :frowning:

var block : Gameobject;
var texture1 : Texture;
var texture2 : Texture;

//The function of block decrease by the texture//
function block

if(Input.GetMouseButtonDown1(โ€œfire1โ€) {{

i want to make the mouse cursor touches the cube and texture1 decreases on the cube.

the defaut colour cube is blue then we click the cube again it becomes red then green and until yellow then destroy.How do i fix this?

like minecraft it has cracking texture on it.

  • Attach the script to the object that you want to change texture

  • Select the object in the Hierarchy

  • In the Inspector find the Artex

  • Click the arrow to open Artex

  • Set the size to 3

  • Drag three textures onto the three entries

    using UnityEngine;
    using System.Collections;

    public class TextureAdvance : MonoBehaviour {

     public Texture[] artex;
     private int i = 0;
    
     void Start () {
     	renderer.material.mainTexture = artex[0];
     }
     
     void OnMouseDown() {
     	i++;
     	if (i >= artex.Length)
     		Destroy (gameObject);
     	else
     		renderer.material.mainTexture = artex*;*
    
  • }*
    }

Thank you!!! i really appreciate you :smiley: