Sajjoo
1
Hello, I am working on my game,s multiplayer module. where i have a bike and i want to change the texture of my opponent,s bike at run time. i have just one prefab which instantiate at runtime. how do i change its texture or do i need to make an other prefab for opponent?
thanks in advance.
You should store a reference to the other bike’s spawned (cloned) prefab, and do something like this:
other_bike.FindChild
("Name of the child gameobject for which you want to change the texture")
.renderer.material.mainTexture=other_texture;
This is assuming you want to change the texture on only one piece of the bike. You can repeat this for all the different mesh renderers on the bike.