From 790303afde04718f7cd1335fc093d6e84b0df93d Mon Sep 17 00:00:00 2001 From: "Nick J. Connors" Date: Sat, 19 Feb 2022 23:47:50 -0500 Subject: [PATCH] Fix entry image loading --- NewHorizons/Builder/ShipLog/RumorModeBuilder.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs index 948dfa33..a8b2cf35 100644 --- a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs @@ -186,17 +186,17 @@ namespace NewHorizons.Builder.ShipLog private static Sprite GetEntrySprite(string entryId, NewHorizonsBody body) { - IModAssets assets = body.Mod.Assets; - string path = body.Config.ShipLog.spriteFolder + "/" + entryId + ".png"; - if (File.Exists(Main.Instance.ModHelper.Manifest.ModFolderPath + path)) + string relativePath = body.Config.ShipLog.spriteFolder + "/" + entryId + ".png"; + try { - Texture2D newTexture = assets.GetTexture(path); + Texture2D newTexture = body.Mod.Assets.GetTexture(relativePath); Rect rect = new Rect(0, 0, newTexture.width, newTexture.height); Vector2 pivot = new Vector2(newTexture.width / 2, newTexture.height / 2); return Sprite.Create(newTexture, rect, pivot); } - else + catch(Exception) { + Logger.LogError($"Couldn't load image for {entryId} at {relativePath}"); return null; } }