Skip to main content

Rotate

TextureUtilities.Rotate()

public static Texture2D Rotate(Texture2D texture, TextureUtility.Rotation rotation)
ParameterTypeDefaultDescription
textureTexture2DThe texture to rotate
rotationTextureUtility.RotationThe rotation to apply. Currently can be 90, 180 or 270 degrees.

Returns: The rotated texture

This function takes in a Texture and rotates it by a certain angle. This overload rotate either Clockwise 90 degrees, Clockwise 180 degrees, or Counter-Clockwise 90 degrees.


public static Texture2D Rotate(Texture2D texture, TextureUtility.Rotation rotation)
ParameterTypeDefaultDescription
textureTexture2DThe texture to rotate
rotationfloatThe rotation to apply.

Returns: The rotated texture

This function takes in a Texture and rotates it by a certain angle. This overload can rotate at any angle

UNSUPPORTED

This overload with the float is currently unsupported, only theorized and is not available in the current version of EZRecolor.


Example Usage

using UnityEngine;
using MikeDaBird.EZRecolor.Utilities;

class RotateTexture : MonoBehavior{
public Texture2D texture;
public TextureUtilities.Rotation rotation = TextureUtilities.Rotation.Clockwise90;

// Rotate a texture by a rotation, both set within the Component
public Texture2D DoARotation(){
texture = TextureUtilities.Rotate(texture, rotation);
return texture;
}
}