I have two textures for my terrain. As a default I use the green texture. However I want my user to be able to change the settings of the game to make the texture red. I have buttons in place that change a string to either say “Green” or “Red”. At the start of my game, the below script is run.
using UnityEngine;
using System.Collections;
public class TerrainTexture : MonoBehaviour {
public Texture green;
public Texture red;
public GameObject mapcheck;
public Terrain terrain;
void Update ()
{
if (mapcheck.GetComponent<Script>().map == "Green")
{
// Switch to Green
}
else if (mapcheck.GetComponent<Script>().map == "Red")
{
// Switch to Red
}
}
}
I have done a lot of research but I had various errors when I tried to put anything at my comments. What can I put in place to change the colour of the terrain? (Essentially switching the first texture to the second or vice versa).