/// <summary> /// Turn byte array to sprite data. /// </summary> /// <param name="data"> Byte array ready to convert to sprite data. </param> /// <param name="pixelPerUnit"> Pixel per unit conversion to world space. </param> /// <returns> Sprite that had been converted. </returns> public static Sprite AsSprite(byte[] data, float pixelPerUnit = 100.0f) { Texture2D tex = AsTexture2D(data); return(JCS_ImageLoader.Create(tex, pixelPerUnit)); }
/// <summary> /// Load screenshot image by file index. /// </summary> /// <param name="index"> File's index. </param> /// <param name="pixelPerUnit"> Pixel per unit conversion to world space. </param> /// <returns> Sprite object that loaded image file by index. </returns> public static Sprite LoadImageByIndex(int index, float pixelPerUnit = 100.0f) { string path = ImagePathByIndex(index); return(JCS_ImageLoader.LoadImage(path, pixelPerUnit)); }
/// <summary> /// Turn byte array to texture data. /// </summary> /// <param name="data"> Byte array ready to convert to texture data. </param> /// <returns> Texture that had been converted. </returns> public static Texture2D AsTexture2D(byte[] data) { return(JCS_ImageLoader.ConvertToTexture(data)); }