Home khkGames Classes Calendar Software Bibliothek Index Contact
Trail: chngeColor.cs

chngeColor.cs

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 public class chngeColor : MonoBehaviour {
	public GameObject ObjectToChangeColor;
	// Use this for initialization
	void Start () {
		//bjectToChangeColor = GameObject.Find("Plane");
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown(KeyCode.R))
        {
            ObjectToChangeColor.GetComponent<Renderer>().material.color = Color.yellow;
            this.GetComponent<Transform>().localScale = new Vector3(0.6f,0.6f,0.6f);
        }
        if (Input.GetKeyDown(KeyCode.G))
        {
           GetComponent<Renderer>().material.color = Color.green;
           this.GetComponent<Transform>().localScale = new Vector3(1.6f,1.6f,1.6f);
        }
        if (Input.GetKeyDown(KeyCode.B))
        {
            GetComponent<Renderer>().material.color = Color.blue;
         }
	}
 }