EnergyEfficiencyManagement/Assets/SKFramework/Tools/SimpleTools/SimpleTool.cs

26 lines
552 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// ͨÓù¤¾ß½Å±¾Àà
/// </summary>
public static class SimpleTool
{
/// <summary>
/// Texture2DתSprite
/// </summary>
/// <param name="texture"></param>
/// <returns></returns>
public static Sprite Texture2Spr(Texture2D texture)
{
Sprite sprite = Sprite.Create(
texture,
new Rect(0, 0, texture.width, texture.height),
new Vector2(0.5f, 0.5f)
);
return sprite;
}
}