How to know height and width of object in screen?
I want to know height and width of object in screen.
I use object world position convert to screen position but I don't know how to get width and height.
I confussed if object mouse position is equal to screen position.
I want to get proportion then I can use mouse position to get object texture relative position pixel.
Thanks for the help!
Answer by _Game_Dev_Dude_ · Nov 17, 2015 at 03:31 PM
http://docs.unity3d.com/ScriptReference/Bounds.html
You can get the bounds of the object from its Mesh, Renderer, or a Collider component.
Is mouse position equal to screen position? Beacause I ues input.mousePosition try to get object position,it have same position. Thanks your reply
Input.mousePosition gives you the Screen Position coordinates of the mouse point. That is correct.
I use Gameobject .GetComponent().bounds.size.x to get render width but it seem have to scale size.It became half of size. Why I look some example just use half of texture size to calculate mouse position to texture pixel position? Thanks for reply!