Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CubeColourChanger : MonoBehaviour {
- //input string to change the colour
- public string sColour="white";
- //the material object
- public Material mMaterial;
- // Update is called once per frame
- void Update () {
- //change colour depending on the input string
- if(sColour== "white")
- {
- mMaterial.color=Color.white;
- }
- if(sColour== "red")
- {
- mMaterial.color=Color.red;
- }
- if(sColour== "green")
- {
- mMaterial.color=Color.green;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement