Resize
TextureUtilities.Resize()
public static Texture2D Resize(Texture2D texture, int targetX, int targetY)
| Parameter | Type | Default | Description |
|---|---|---|---|
| texture | Texture2D | The Texture2D to rescale | |
| targetX | int | Target width | |
| targetY | int | Target height |
Returns: Resized texture
A simple resize algorythm to scale up or down a Texture2D.
Example Usage
using UnityEngine;
using MikeDaBird.EZRecolor.Utilities;
class RotateTexture : MonoBehavior{
public Texture2D texture;
public Vector2 newScale;
// Scale a texture by a scale factor, both set within the Component
public Texture2D Scale(){
texture = TextureUtilities.Resize(texture, newScale.x, newScale.y);
return texture;
}
}