This is Not an ideal method , but it should get you going. (personally I would create one material with all the numbers on it , then swap the UV to display the correct number).
First create the textures (images/pictures) 0 - 9.
Then make 10 materials , and apply each picture to a material.
create a cube , then create a script , and attach the script to the cube.
Copy and paste the below script in your cube script.
in the cube’s inspector, drag and drop each material to the correct place in the inspector at Mat 0, Mat 1, etc
Hit play =]
every 1.5 seconds , the number on the cube should change.
here is what’s happening :
each material is stored in a variable : public var mat0 : Material;
etc
then an array of these materials is made : materialsArr = [mat0, mat1, mat2, mat3, mat4, mat5, mat6, mat7, mat8, mat9];
the material is being changed by this command : renderer.material = materialsArr[currentMaterial];
play around with putting different materials into variables , then change the material in the script with :
renderer.material = materialVariable ;
oh , here’s the script :
public var mat0 : Material;
public var mat1 : Material;
public var mat2 : Material;
public var mat3 : Material;
public var mat4 : Material;
public var mat5 : Material;
public var mat6 : Material;
public var mat7 : Material;
public var mat8 : Material;
public var mat9 : Material;
public var materialsArr : Material[];
public var currentMaterial : int = 0;
function Start()
{
materialsArr = [mat0, mat1, mat2, mat3, mat4, mat5, mat6, mat7, mat8, mat9];
currentMaterial = 0;
renderer.material = materialsArr[currentMaterial];
InvokeRepeating("ChangeMaterial", 1.5, 1.5);
}
function ChangeMaterial()
{
currentMaterial++;
if (currentMaterial == 10) {currentMaterial = 0;}
renderer.material = materialsArr[currentMaterial];
}