I have a simple application with unity that displays a rectangle, and when you press the key “a”, it displays a random color. It works just fine in Unity, but when i build it and run outside of unity, it displays the rectangle but doesn’t do anything when i press “a”. here is my code:
using UnityEngine;
using System.Collections;
public class ColorUI : MonoBehaviour {
Renderer render;
void Start () {
render = GetComponent<Renderer> ();
}
void Update () {
if (Input.GetKeyDown("a")) {
render.material.color = new Color(Random.value, Random.value, Random.value, 1.0f);
}
}
}