Hey all, i am trying to make it so when you click on a tank in my game a HUD or selection square appears around it, i tried using a GUI Texture but because my tank has a rigid body the GUI texture just falls and doesn't stop. I have my own GUI texture which i want to apply so i cannot use script made textures.
If anyone is confused its like most games where you require a mouse, when you click on one of your tanks or an enemy tank it will select it an show a box around it, and then you know that this tank is selected.
Please help thanks to anyone that does!
asked Dec 04 '11 at 11:18 AM
I'm not sure what your problem seems to be, if you have a guitexture object, it shouldn't go anywhere unless you put a rigidbody component on it. Even then you can also turn off gravity on it.
The way I would go about it: Instantiate a plane with the material you want under the tank's hierarchy so your "selection" box moves with the tank.
Of course the problem with this is that if tanks are different distances to the camera, the planes will appear bigger or smaller, or it may not be a problem at all depending on if you want that feature.
On this plane, you can also have a script making it face the camera.
Place code in a FixedUpdate function.
answered Dec 04 '11 at 12:12 PM