I have a house model in my gameview. I’m using Javescript. And I need to get the height, width and depth of each object as I select them with mouse. I have a code that gives me these values, but it only works when I click objects in the design view. Can someone help me out with this? :-?
PS: This is the code that gives the values of objects when i click them in the design view.
function OnGUI (){
var thisObject = Selection.activeGameObject;
if (!thisObject) {return;}
var renderer = thisObject.renderer;
if (!renderer) return;
var bounds = renderer.bounds;
if (bounds == null) return;
var size = bounds.size;
GUI.Label(Rect (10, 10, 200, 200), "Size\nX: " + size.x + " Y: " + size.y + " Z: " + size.z);