private void LoadEnvironment(Environments e) { environment = e; texture = Assets.Get(environment).texture; mat = Assets.Get(environment).mat; textureSize.x = texture.width / pixelsPerTile; textureSize.y = texture.height / pixelsPerTile; dynamicMesh.CreateMesh(LevelBuilder.GenerateMesh(map, textureSize), texture, mat); if (!isInEditMode) { Destroy(skybox); skybox = Instantiate <GameObject> (Assets.Get(environment).skybox); } }