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 particularly useful when you need both the width and height of the texture for calculations or rendering purposes.
// Example of accessing the Size property of a Texture Texture myTexture = Texture.Load("path/to/texture"); Vector2 textureSize = myTexture.Size; // Output the width and height float width = textureSize.x; float height = textureSize.y; // Use the size for further processing if (width > 100 && height > 100) { // Perform some operation }