Returns a Vector2
representing the size of the texture, where the x component is the width and the y component is the height.
Returns a Vector2
representing the size of the texture, where the x component is the width and the y component is the height.
Use the Size
property to quickly access the dimensions of a texture in a single call. This is useful when you need both the width and height of the texture for operations such as scaling or positioning in a 2D space.
// Example of accessing the Size property of a Texture Texture myTexture = Texture.Load("path/to/texture"); Vector2 textureSize = myTexture.Size; // Use the size for some operation float width = textureSize.x; float height = textureSize.y; // Output the size Debug.Log($"Texture Size: {width}x{height}");