The idea here is to draw a bounding box to indicate to the user that a game-object is selected. How can I do this outside of Editor mode (say published player)?
Note: What if I wish the bounding box to be rendered within its 3d space
The idea here is to draw a bounding box to indicate to the user that a game-object is selected. How can I do this outside of Editor mode (say published player)?
Note: What if I wish the bounding box to be rendered within its 3d space
If by "3D bounding box" you mean something like a cube, then do this: Instantiate a cube with a partially-transparent material, give it the same position and rotation of the object, then use the object's mesh.bounds to scale the cube to the correct size.
If you're talking about wireframes, then yeah, you can certainly make 3D wireframe bounding boxes with Vectrosity. Unfortunately wireframe line drawing is normally not that simple to do in Unity outside the editor, which is why I made this utility, in order to fix that problem.
(Assuming that you mean a bounding box as in most rts-games and not a 3d bounding box:)
I'm treading on very thin ice here because I never tinkered with bounds, so I can only guess how I would do it if I had to. Sorry if I state the obvious.
See also:
Answering your comment: See #4. If you use a transparent material with a border-texture it shouldn't look too bad as long as the box is not stretched too much. Alternatively, take a look at Eric5h5's Vectrosity if you have a few bucks to spend: http://forum.unity3d.com/viewtopic.php?t=53268
Meta: Seriously, why can't I post comments? I got enough of this stupid rep according to the faq, so what's the big deal?
I have developed my own solution for a runtime wireframe bounding box. I have based it on the mesh.renderer.bounds or alternatively collider, dealt with a script attached to object. The box itself is being drawn by another script attached to camera and using GL.LINES. You can see in working on my blog page http://virtualplayground.d2.pl and can download these scripts from there.
Vectrosity looks great!
– Extrakun