Rukey4
1
I wondered if there was a simple way to change the texture on an already textured object using a trigger?
With something similar to this which has worked with playing animation with an invisible trigger, but how do I code to change the texture once the trigger has been activated?
function OnControllerColliderHit (hit : ControllerColliderHit)
{
if (hit.gameObject.tag == "Cube")
Getmaterial.object == "From File)
The Get material is only a guess, but does anyone have an answer?
IJM
2
Crate an folder named "Resources" in your assets.(If you don't have one) Put your texture in that folder. (For example "TextureName.png") And call this on the trigger:
renderer.material.mainTexture = Resources.Load("TextureName");