- Home /
Crosshair changes to opposite colour when hovering over something
I have a crosshair .png in my project, which is tied to a UI Image (which means it is tagged a 2D sprite). It is is a first person game so it is just stuck to the center. (http://gyazo.com/4a9d2d188d1208e2cc0a1f5f51d416e4) Is there any simple method of making it's colour change to an opposite one when it is hovering over something?
Example: The player looks towards a white stone--the crosshair changes to the opposite colour (in this case, black).
As easy as that. Thanks in advance
Answer by AngryBurritoCoder · Dec 13, 2014 at 03:21 PM
Use racyasts to check what is infront of the camera in forward direction, if something hit, change crosshair colour
http://docs.unity3d.com/ScriptReference/Physics.Raycast.html
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to import the object from server to unity 2 Answers
How do I change my crosshair/cursor when I look at an object 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer