mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
fix sprite tools assembly issues
This commit is contained in:
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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user