I’m having trouble with this script, not getting more textures in the script, but when I edit the scrip of error saying: expecting}, found else, I want to put 6 textures and when you click the right mouse button they change in order
#pragma strict
var imagem0 : Texture;
var imagem1 : Texture;
var imagem2 : Texture;
var CurrentColor : boolean = true;
function Update () {
// switch colors
if(Input.GetButtonDown(“Fire2”))
{
if(renderer.material.mainTexture == imagem0)
renderer.material.mainTexture = imagem2;
else
renderer.material.mainTexture = imagem1;
else
renderer.material.mainTexture = imagem0;
}
}
}
Don’t want to bust balls, but or the love of god format your code better, both in the editor and when you post. You’ll save everyone some sanity.
var imagem0 : Texture;
var imagem1 : Texture;
var imagem2 : Texture;
var CurrentColor : boolean = true;
function Update () {
// switch colors
if(Input.GetButtonDown("Fire2"))
{
if(renderer.material.mainTexture == imagem0)
renderer.material.mainTexture = imagem2;
else renderer.material.mainTexture = imagem1;
// ELSE RIGHT AFTER ANOTHER ELSE
else renderer.material.mainTexture = imagem0; } } }
You have an else following an else, You probably meant to put an end curly brace after the first else.