GameObjectの幅、高さ、奥行きを取得する
SpriteRenderer spriteRenderer = gameObject.GetComponent<SpriteRenderer>(); Bounds bounds = spriteRenderer.bounds; Vector3 vector3 = bounds.size; float x = vector3.x; float y = vector3.y; float z = vector3.z;
Sample code collection
SpriteRenderer spriteRenderer = gameObject.GetComponent<SpriteRenderer>(); Bounds bounds = spriteRenderer.bounds; Vector3 vector3 = bounds.size; float x = vector3.x; float y = vector3.y; float z = vector3.z;