my question was solved, and this can be used to make a gui when you type letters, and it will change the color of the text.
// Fade the color from red to green
// back and forth over the defined duration
var colorStart : Color = Color.red;
var colorEnd : Color = Color.green;
var duration : float = 1.0;
function Update () {
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
guiText.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}
//heres the entire script im using.
//so i can access it from all scripts i made a static var.
//so when you type in the cheat code it will flash from white to yellow.
static var Cheat = false;
var colorStart : Color = Color.white;
var colorEnd : Color = Color.yellow;
var duration : float = 0.5;
// Shows how to read typing input from the keyboard
// (eg. the user entering his name).
// You need to attach this script to a GUIText object.
function Update () {
for (var c : char in Input.inputString) {
// Backspace - Remove the last character
if (c == "\b"[0]) {
if (guiText.text.Length != 0)
guiText.text = guiText.text.Substring(0, guiText.text.Length - 1);
}
// End of entry
else if (c == "
"[0] || c == "\r"[0]) {// "
" for Mac, "\r" for windows.
print ("User entered his name: " + guiText.text);
Application.LoadLevel(13);
}
// Normal text input - just append to the end
else {
guiText.text += c;
}
}
if(Cheat)
{
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
guiText.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}
}
my main cheat code script:
var LinLoser = false;
var OinLoser = false;
var SinLoser = false;
var EinLoser = false;
var RinLoser = false;
private var NotGoingToHappen = false;
function Update()
{
if(Input.GetKey("l"))
{
LinLoser = true;
}
if(Input.GetKey("o"))
if(LinLoser)
{
OinLoser = true;
}
if(Input.GetKey("s"))
if(LinLoser)
if(OinLoser)
{
SinLoser = true;
}
if(Input.GetKey("e"))
if(LinLoser)
if(OinLoser)
if(SinLoser)
{
EinLoser = true;
}
if(Input.GetKey("r"))
if(LinLoser)
if(OinLoser)
if(SinLoser)
if(EinLoser)
{
RinLoser = true;
}
if(LinLoser)
if(OinLoser)
if(SinLoser)
if(EinLoser)
if(RinLoser)
{
Cheatcodescontrol.CHEAT = true;
Application.LoadLevel(14);
}
//other alphabet letters
if(Input.GetKey("a"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("b"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("c"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("d"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("f"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("g"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("h"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("i"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("j"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("k"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("m"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("n"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("p"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("q"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("t"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("u"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("v"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("w"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("x"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("y"))
{
NotGoingToHappen = true;
}
if(Input.GetKey("z"))
{
NotGoingToHappen = true;
}
if(NotGoingToHappen)
{
Destroy(this);
}
}
my second cheat control script:
static var CHEAT = false;
var colorStart : Color = Color.white;
var colorEnd : Color = Color.yellow;
var duration : float = 0.5;
// Shows how to read typing input from the keyboard
// (eg. the user entering his name).
// You need to attach this script to a GUIText object.
function Update () {
for (var c : char in Input.inputString) {
// Backspace - Remove the last character
if (c == "\b"[0]) {
if (guiText.text.Length != 0)
guiText.text = guiText.text.Substring(0, guiText.text.Length - 1);
}
// End of entry
else if (c == "
"[0] || c == "\r"[0]) {// "
" for Mac, "\r" for windows.
print ("User entered his name: " + guiText.text);
Application.LoadLevel(13);
}
// Normal text input - just append to the end
else {
guiText.text += c;
}
}
if(CHEAT)
{
var lerp : float = Mathf.PingPong (Time.time, duration) / duration;
guiText.material.color = Color.Lerp (colorStart, colorEnd, lerp);
}
}
could you tell me if anything is wrong or if a part of a script is missing?
thanks!