Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How to get the same texture of other object?

$
0
0
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?

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>