Created
September 30, 2017 07:44
-
-
Save nrfm/95ddbf5c5b38be6621b262b7dff3dd76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class MaterialColorChanger : MonoBehaviour | |
{ | |
void Update() | |
{ | |
if (Input.GetKeyDown(KeyCode.R)) | |
{ | |
GetComponent<Renderer> ().material.color = Color.red; | |
} | |
if (Input.GetKeyDown(KeyCode.G)) | |
{ | |
GetComponent<Renderer>().material.color = Color.green; | |
} | |
if (Input.GetKeyDown(KeyCode.B)) | |
{ | |
GetComponent<Renderer>().material.color = Color.blue; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment