So i have a bot, which have random texture assignment. There is script:
#pragma strict
var textures : Texture[];
private var rnd : float;
function Start () {
rnd = Random.Range(1,4);
if(rnd == 1){
renderer.material.mainTexture = textures[0];
}
if(rnd == 2){
renderer.material.mainTexture = textures[1];
}
if(rnd == 3){
renderer.material.mainTexture = textures[2];
}
}
And i need to destroy this object and instantiate the ragdoll object with the same texture. Is there possible? Or i need make 3 prefabs with different texture and 3 ragdoll prefabs?
↧