I am making a simple build where i can pan, zoom and rotate an object in the middle.
And it works fine…After some struggle.
Now i am stuck with compiler error again when trying to make text appear when my cursor hovers over a Gameobject.
Why do i get compiler error in this script?
I have done everything the tutorial showed me?
I do not get any messages in the console either.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Varenummer : MonoBehaviour
{
public string myString;
public Text myText;
public float fadeTime;
public bool displayInfo;
void Start()
{
myText = GameObject.Find ("Text").GetComponent<myText> ();
myText.color = Color.clear;
}
void Update()
{
FadeText();
}
void OnMouseOver()
{
displayInfo = true;
}
void OnMouseExit ()
{
displayInfo = false;
}
void FadeText ()
{
if(displayInfo)
{
myText.text = myString;
myText.color = Color.Lerp (myText.color, Color.white, fadeTime * Time.deltaTime);
}
else
{
myText.color = Color.Lerp (myText.color, Color.clear, fadeTime * Time.deltaTime);
}
}
}