diff --git a/JotunnLib/Utils/AssetUtils.cs b/JotunnLib/Utils/AssetUtils.cs index e2fdb6bd3..4c989e5d4 100644 --- a/JotunnLib/Utils/AssetUtils.cs +++ b/JotunnLib/Utils/AssetUtils.cs @@ -54,12 +54,23 @@ public static Texture2D LoadTexture(string texturePath, bool relativePath = true /// Texture path relative to "plugins" BepInEx folder /// Texture2D loaded, or null if invalid path public static Sprite LoadSpriteFromFile(string spritePath) + { + return LoadSpriteFromFile(spritePath, Vector2.zero); + } + + /// + /// Loads a from file at runtime. + /// + /// Texture path relative to "plugins" BepInEx folder + /// The pivot to use in the resulting Sprite + /// Texture2D loaded, or null if invalid path + public static Sprite LoadSpriteFromFile(string spritePath, Vector2 pivot) { var tex = LoadTexture(spritePath); if (tex != null) { - return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(), 100); + return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), pivot); } return null;