Unity3D Turtorial:27 Player Material Changer
THIS IS Java# script: GOOD 4 2D GAMES AND 3D GAMES !
--------------------------------------------------------------------------------------
DIRECT DOWNLOAD HERE
THIS IS BACKUP IN TEXT FORM TUTORIAL 27 Script option 1
1. Create New java and name it : MaterialChangerByMouseButon
2. Copy & Past this text and save java :
---------------------------------------------------------------------------------
#pragma strict
var matArray : Material[];
private var index : int;
function Update () {
if (Input.GetButtonDown("Fire1")) {
index++;
index = index % matArray.Length;
renderer.material = matArray[index];
}
}
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
THIS IS BACKUP IN TEXT FORM TUTORIAL 27 Script option 2
1. Create New java and name it : materialchangeronkeypress
2. Copy & Past this text and save java :
---------------------------------------------------------------------------------
#pragma strict
var matArray : Material[];
private var index : int;
function Update () {
if (Input.GetKeyDown (KeyCode.Q)) {
index++;
index = index % matArray.Length;
renderer.material = matArray[index];
}
}
---------------------------------------------------------------------------------
0 comments:
Post a Comment