private IEnumerator SpawnMovingObject() { while (true) { if (simplePool.GetPoolObject() != null && isActive) { for (int i = 0; i < meshData.Length; i++) { if (name.Equals(meshData[i]._Preview.name)) { simplePool.GetPoolObject().GetComponent <MeshFilter>().mesh = meshData[i]._Mesh; simplePool.GetPoolObject().GetComponent <MeshCollider>().sharedMesh = meshData[i]._Mesh; simplePool.GetPoolObject().SetActive(true); onScorePlus(); } } } yield return(new WaitForSeconds(6f)); } }