Unity change mesh renderer material

Advertisemen

Unity change mesh renderer material
































DIRECT DOWNLOAD HERE











THIS IS BACKUP  IN TEXT FORM 

1. Create New C# and name it : TextureChanger


2. Copy & Past this text and save C# :
----------------------------------------­­­­­------------------------------------­-­-­-­-­-


using UnityEngine;
using System.Collections;

public class TextureChanger: MonoBehaviour {

public Texture TextureHere; 


void OnTriggerEnter(Collider other){
if(other.gameObject.tag == "Player"){
renderer.material.mainTexture = TextureHere;
audio.Play();
}
}
void OnTriggerExit(Collider other){
if(other.gameObject.tag == "Player"){

GetComponent<BoxCollider >().enabled = false;
}
}
}







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



























































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