- Home /
Mesh change at runtime or in editor
I've tried simple code:
public Mesh simpleShip;
void Start()
{
Mesh mMesh = Instantiate(simpleShip) as Mesh;
gameObject.GetComponent<MeshFilter>().mesh = mMesh;
}
I assigned the simpleShip to a known working mesh (in another project), it compiles and runs, no warnings at all, it assigns it to the MeshFilter successfully, but the mesh never changes. I also tried assigning it directly in the editor, without the script.
There was no meshFilter when I started, so I added that too, of course. Is there another, overriding, method of mesh control? These are the only 2 methods I know for mesh assignment.
Comment
Your answer
Follow this Question
Related Questions
Modify a mesh at runtime 0 Answers
How can I assign a GameObject to a variable at runtime? 0 Answers
Generated mesh render order 0 Answers
Creating Irregular 2D Shapes in Runtime 0 Answers
disabling Mesh renderer on runtime. 1 Answer