Unity3D Turtorial:27 Player Material Changer

Advertisemen

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];
     }
 }



 ----------------------------------------­­­­­------------------------------------­-­-­-­-­-





















Advertisemen

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Tutorial Unity 3D