Like it says in the title im setting a new tag with tag = “newtag” but it keeps its old tag. I checked twice the new tag does exist.
void Update()
{
if (tag == “DoMeshTopLeft”);
{
GetComponent().mesh = CrateMeshChunk();
GetComponent().mesh = CrateMeshChunk();
}
StartCoroutine (StretchMethod());
if (tag == “DontMeshTopLeft”)
{
GetComponent().mesh = CrateMeshChunkDontMeshTopLeft();
GetComponent().mesh = CrateMeshChunkDontMeshTopLeft();
}
}
In the above code StartCoroutine is called in update,it has called multiple times before executing the return of yeild statement of StartCoroutine.Instead of StartCoroutine use invoke() or StretchMethod().
void Update()
{
if (tag == "DoMeshTopLeft");
{
GetComponent<MeshFilter>().mesh = CrateMeshChunk();
GetComponent<MeshCollider>().mesh = CrateMeshChunk();
}
Invoke("StretchMethod", 2);
// StretchMethod();
if (tag == "DontMeshTopLeft")
{
GetComponent<MeshFilter>().mesh = CrateMeshChunkDontMeshTopLeft();
GetComponent<MeshCollider>().mesh = CrateMeshChunkDontMeshTopLeft();
}
}