- Home /
This question was
closed Aug 01, 2014 at 02:11 PM by
Josh Naylor for the following reason:
Duplicate Question
How to change a mesh using a script?
Hello, this is my first UNITY 3D game and i have a "problem" (it's not a problem at all, it's just something i don't no how to do), well i'm making an FPS and i have a code that changes the color of the player depending on his team, the code is like this:
if(teamID==1) mySkin.material.color = Color.red; if(teamID==2) mySkin.material.color = new Color(.5f, 1f, .5f);
i wanna know HOW can I do the same think, but, changing the mesh, not the main color.
PS: I'm using C#.
Comment
Answer by Fyoucon · Aug 01, 2014 at 09:01 AM
You need to use the mesh variable on the MeshFilter
GetComponent<MeshFilter>().mesh = <someMesh>