fix sprite tools assembly issues

This commit is contained in:
XtraCube committed 2024-08-22 14:48:54 -04:00
1 parent c11fe14fd2
commit 49ac51f039
2 files changed
+6 -4

No files matched your search

@@ -1,9 +1,12 @@
using UnityEngine;
using System.Reflection;
using UnityEngine;
namespace MiraAPI.Utilities.Assets;
public class LoadableResourceAsset(string path) : LoadableAsset<Sprite>
{
private readonly Assembly _assembly = Assembly.GetCallingAssembly();
public override Sprite LoadAsset()
{
if (LoadedAsset != null)
@@ -13,7 +16,7 @@ public class LoadableResourceAsset(string path) : LoadableAsset<Sprite>
try
{
return LoadedAsset = SpriteTools.LoadSpriteFromPath(path);
return LoadedAsset = SpriteTools.LoadSpriteFromPath(path, _assembly);
}
catch
{
+1 -2
View File
@@ -32,10 +32,9 @@ public static class SpriteTools
/// <param name="resourcePath">The path to the resource.</param>
/// <returns>A sprite made from the resource</returns>
/// <exception cref="Exception">The resource cannot be found.</exception>
public static Sprite LoadSpriteFromPath(string resourcePath)
public static Sprite LoadSpriteFromPath(string resourcePath, Assembly assembly)
{
var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false);
var assembly = Assembly.GetExecutingAssembly();
var myStream = assembly.GetManifestResourceStream(resourcePath);
if (myStream != null)
{