Vector2 Size { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

Returns a Vector2 representing the size of the texture, where the x component is the width and the y component is the height.

Usage

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

// 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}");