Why won't script work on 3d text? (menu script)

So here is my code:

function OnMouseEnter() { GetComponent(Renderer).material.color = Color.grey; } function OnMouseExit() { GetComponent(Renderer).material.color = Color.white;  }

When I assign this to a regular game object like a cube it works fine, changing to grey when I hover over it with my mouse and changing to white when I take it away. But when I try assigning this to 3d text nothing happens no matter what I do. What am I doing wrong, and how do I fix this?

OnMouseEnter()/OnMouseExit() requires a Collider attached to the object. Testing in Unity 5.3 shows adding a BoxCollider2D works fine for me.

If you’re making a 2D game you can assign it to a new Layer and use the Physics2D player settings to have it ignore collisions to all other layers. That way it won’t collide with objects in the game. If making a 3D game there’s no worries as 3D physics doesn’t interact with the 2D physics.