Changing the color of an object at runtime can be a very effective way of letting players know that they can interact with it. This is very useful in a number of game genres, such as puzzles and point-and-click adventures, and it can also be used to create 3D user interfaces.
Highlighting materials at mouse-over
How to do it...
To highlight a material at mouse-over, follow these steps:
- Create a new 3D project.
- Create 3D Cube in the scene (Hierarchy menu: Create | 3D Object | Cube).
- In the Project panel, create a new Material aaset named m_cube. Set its Albedo Color to red.
- In the Hierarchy, select the Cube GameObject, and assign it the m_cube Material (drag the asset from the Project panel).
- Create a new C# script-class named...