Hi!
I’m having a little problem here,
This is a script I am using on a model to switch through 3 different textures:
// Assign the texture exposed in the inspector the renderer's material
var textures : Texture[];
// When you click on the object
function OnMouseDown() {
// we want this texture index now
var index : int = Time.time;
// take a modulo with size so that animation repeats
index = index % textures.length;
// assign it
renderer.material.mainTexture = textures[index];
}
In The inspector it looks like:
[![[/url]
This part is really working great, and it does what I want. (Change the texture each time I click on it.)
* ps: the black lines are in place to keep the name a secret (upcomming project)
Now I have a little problem, I’m trying to add some functions into the script. For an example on what I mean I will just take this piece:
Destroy(gameObject);
So if I get to texture Element 1 I want this to happen using an “if” statement.
When I get to texture Element 2 I want another thing to happen etc.
Does anyone know what variables to use to achieve this result? I pretty much tried the last 4 hours getting this to work
Thank You!
This part is really working great, and it does what I want. (Change the texture each time I click on it.)
* ps: the black lines are in place to keep the name a secret (upcomming project)
Now I have a little problem, I’m trying to add some functions into the script. For an example on what I mean I will just take this piece:
§_DISCOURSE_HOISTED_CODE_1_§
So if I get to texture Element 1 I want this to happen using an “if” statement.
When I get to texture Element 2 I want another thing to happen etc.
Does anyone know what variables to use to achieve this result? I pretty much tried the last 4 hours getting this to work
Thank You!