public void ReGenerate(int _level) { // Before regenerate model, we need to delete all lines. foreach (GameObject line in GameObject.FindGameObjectsWithTag("Line")) { Destroy(line); } CurrentLevel = _level; Init(); player.DSReset(); // Reload a material uv image(Now we don't need this because we have an array of materials.) //LoadMaterialByLevel(CurrentLevel); // Reload a new goal image. path1 = Path.Combine(Application.streamingAssetsPath, "Unfolding/_Results/Level"); path = path1 + CurrentLevel + path2; Texture2D newTexture = new Texture2D(250, 125); byte[] ImageBytes = File.ReadAllBytes(path); newTexture.LoadImage(ImageBytes); goalImage.texture = newTexture; // Clear the previous log content and reset the timer. logtool.ClearLog(); logtool.ResetTimer(); }