- Home /
Draw square texture around selected tile
How would I draw a square to highlight the current tile I have selected? Here is my code for selecting. I just want a transparent square drawn around my current texture if it is possible.
void OnMouseOver() {
selected = true;
if(Input.GetMouseButtonDown(0) && breakable == true){
Destroy(gameObject);
}
}
Answer by DaveA · Mar 19, 2012 at 09:11 PM
Couple thoughts:
a) You can replace the texture with one that has the extra highlight b) You can make an extra mesh with that highlight that you turn on/off the renderer
May be other options. What is your 'tile'? Is it 2d, 3d? Will this be in screen-space or world-space?
Do you want the highlight to appear in world space too, or in the 'HUD'?
Switching the cube's material seems more appropriate than changing the texture, in the case all your cubes share their materials.
Yeah, agree with Dakwa$$anonymous$$e. Look into a Glow shader maybe, although a Fur shader might be ok too.