- Home /
Question by
simeonradivoev · May 14, 2012 at 12:22 AM ·
notworkingchangingingame
splatPrototypes not changing in exported game
when i change the terrain splatPrototypes, with random textures chosen from an array of textures, the terrain gets all black, but it work fine in the editor.
function RandomTexture(){
var TerrainTexturesGroundRand:int = Random.Range(0,TerrainTexturesGround.Length-1);
var TerrainTexturesGroundDetailRand:int = Random.Range(0,TerrainTexturesGround.Length-1);
var Splats:SplatPrototype[] = TerrainToChange.terrainData.splatPrototypes;
Splats[0].texture = TerrainTexturesGround[TerrainTexturesGroundRand];
Splats[1].texture = TerrainTexturesGround[TerrainTexturesGroundDetailRand];
//choose a texture for the rock
var TerrainTexturesRockRand:int = Random.Range(0,TerrainTexturesRock.Length-1);
Splats[2].texture = TerrainTexturesRock[TerrainTexturesRockRand];
TerrainToChange.terrainData.splatPrototypes = Splats;
}
Comment
Your answer
Follow this Question
Related Questions
Jump Script, no luck getting it to work.. 2 Answers
OnSerializenetworkView not doing anything?? 1 Answer
Animation not working 1 Answer
Unity shadows work in scene, but no through camera 0 Answers
Gun reload not working? 1 Answer