im trying to set my game at the moment so when the mouse hovers over a block, it will change the colour, essentially highlighting it
No matter what I try, making sure what the mouse hits is a block and nothing else, it wont change or even debug.log
Examples of what i have tried and nothing has worked:
so your saying i need to add this script onto my blocks?
But in the same script attached to the camera i can click and change a blocks colour, so that doesnt make sense
what i have described, trying to get it to colour a block as a highlight only when the mouse is on it, not clicked, isnt working
while clicking a block changes a colour, so i dont see why one works and the other doesnt
bump can anyone help me convert the script above, used for changing the colour of a block when clicked, to changing the colour only when the mouse hovers over it and then changes back when the mouse isnt on it
Most attempts you had done where OK, you just needed to place them on the cube instead of the camera.
The camera script you showed sends a raycast towards the cube. The other one uses built in unity hovering detection that must be applied on the target object itself.
It’s like if you have one sniper script that shots targets and a foursquare app where the target is supposed to locate himself, except that you gave the foursquare app to the snipper instead of the target…