Skip to content

Commit da8aec8

Browse files
committed
Update ImageLoader.cs
1 parent b6ec0c5 commit da8aec8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Assets/_PackageRoot/Runtime/ImageLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static Sprite ToSprite(Texture2D texture, Vector2 pivot, float pixelDensi
7171
/// <param name="ignoreImageNotFoundError">Ignore error if the image was not found by specified url</param>
7272
/// <returns>Returns sprite asynchronously </returns>
7373
public static UniTask<Sprite> LoadSprite(string url, TextureFormat textureFormat = TextureFormat.ARGB32, bool ignoreImageNotFoundError = false)
74-
=> LoadSprite(url, Vector2.one * 0.5f, textureFormat, ignoreImageNotFoundError);
74+
=> LoadSprite(url, new Vector2(0.5f, 0.5f), textureFormat, ignoreImageNotFoundError);
7575

7676
/// <summary>
7777
/// Load image from web or local path and return it as Sprite
@@ -118,7 +118,7 @@ public static async UniTask<Sprite> LoadSprite(string url, Vector2 pivot, Textur
118118
var texture = new Texture2D(2, 2, textureFormat, true);
119119
if (texture.LoadImage(cachedImage))
120120
{
121-
var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), pivot);
121+
var sprite = ToSprite(texture, pivot);
122122
if (sprite != null)
123123
SaveToMemoryCache(url, sprite, replace: true);
124124

0 commit comments

Comments
 (0)