Sunday, 20 December 2015

Unity change mesh renderer material

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







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



























































0 comments:

Post a Comment