- Home /
Terrain Texture (applied programatically) Disappears When Entering Play Mode
Hello all, I am working on a project which will enable a user to input information about a terrain, such as its size, its textures, its heightmap, and the variables associated with those entities, and alter the terrain accordingly. Right now, the code does allow the user to input a terrain size, and select a texture, which is immediately applied to the terrain itself. The texture maps correctly in the inspector, and in the Scene View, but when I click play and launch play mode, the terrain size (as well as the accompanying heightmap) remain the same as the Scene View's terrain, but the texture is gone.
So far, the program creates an array (of length 1) containing splatPrototypes, then creates a SplatPrototype, and assigns the .png file the user selected to that SplatPrototype's texture value (using a WWW instance), and assigns user provided values for the tile size to the SplatPrototype's tile size values. The tile offset values are defaulted to zero. The created SplatPrototype is loaded into the array. This array is assigned to the TerrainData's SplatPrototype array, so the created SplatPrototype automatically becomes the terrain's texture.
That should mean that the terrainData stores that value until some other code changes it back. But, for some reason, the texture is not there when I enter Play Mode. Any suggestions?
Your answer
Follow this Question
Related Questions
terrainData.heightmapTexture float value range 2 Answers
Is there a way to paint tessellation or displacement textures on a terrain? 1 Answer
Sample Color on Terrain 0 Answers
SetAlphaMaps Opacity Gradient 0 Answers
SetPixel() on Terrain 0 Answers