- Home /
Question by
MosesTheProphet · Jun 17, 2016 at 03:04 PM ·
c#colormenu3dtext
I want to change my 3D Text's color when mouse over.
I guess it's kinda stupid monkey's code, but i'm newbee here, and wrote this using pieces of other codes. Why it doesn't work?
using UnityEngine;
using System.Collections;
public class Menu : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
OnMouseEnter ();
OnMouseExit ();
}
void OnMouseEnter() {
GetComponent<Renderer>().material.color = Color.red;
}
void OnMouseExit() {
GetComponent<Renderer>().material.color = Color.white;
}
}
Comment
Best Answer
Answer by Tasarran · Jun 17, 2016 at 03:08 PM
Does your 3D Text have a Collider?
You need a Collider to know when you enter and exit the object.
You also don't need to put the events in Update (and you shouldn't).
Your answer
Follow this Question
Related Questions
3d text color 4 Answers
Multiple Cars not working 1 Answer
Changing 3DText color through C# script (non-GUI) 1 Answer
Distribute terrain in zones 3 Answers
surface shader homeworld (space) colorize transparent 1 Answer