MeshFilter meshfilt = Player.GetComponent();
meshfilt.mesh = Resources.Load(“Corner”) as Mesh;
I’m trying load new mesh to meshfilter but when I hit play button the mesh name has been changed to NONE
Mesh file is in Resources folder.
MeshFilter meshfilt = Player.GetComponent();
meshfilt.mesh = Resources.Load(“Corner”) as Mesh;
I’m trying load new mesh to meshfilter but when I hit play button the mesh name has been changed to NONE
Mesh file is in Resources folder.
Don’t use Resources.Load for this.
Instead:
public Mesh replacementMesh;
private void Start()
{
var meshFilter = Player.GetComponent<MeshFilter>();
meshFilter.mesh = replacementMesh;
}
and then drag the mesh in question into the inspector.