diff --git a/NewHorizons/Builder/Body/HeightMapBuilder.cs b/NewHorizons/Builder/Body/HeightMapBuilder.cs index 3255b839..064ad645 100644 --- a/NewHorizons/Builder/Body/HeightMapBuilder.cs +++ b/NewHorizons/Builder/Body/HeightMapBuilder.cs @@ -23,23 +23,23 @@ namespace NewHorizons.Builder.Body Texture2D heightMap, textureMap, emissionMap; try { - if (module.heightMap != null && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.heightMap))) + if (!string.IsNullOrEmpty(module.heightMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.heightMap))) { Logger.LogError($"Bad path for {planetGO.name} heightMap: {module.heightMap} couldn't be found."); module.heightMap = null; } - if (module.textureMap != null && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.textureMap))) + if (!string.IsNullOrEmpty(module.textureMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.textureMap))) { Logger.LogError($"Bad path for {planetGO.name} textureMap: {module.textureMap} couldn't be found."); module.textureMap = null; } - if (module.emissionMap != null && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.emissionMap))) + if (!string.IsNullOrEmpty(module.emissionMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.emissionMap))) { Logger.LogError($"Bad path for {planetGO.name} emissionMap: {module.emissionMap} couldn't be found."); module.emissionMap = null; } - if (module.heightMap == null) + if (string.IsNullOrEmpty(module.heightMap)) { heightMap = Texture2D.whiteTexture; } @@ -52,7 +52,7 @@ namespace NewHorizons.Builder.Body heightMap = ImageUtilities.GetTexture(mod, module.heightMap); } - if (module.textureMap == null) + if (string.IsNullOrEmpty(module.textureMap)) { textureMap = Texture2D.whiteTexture; } @@ -61,7 +61,7 @@ namespace NewHorizons.Builder.Body textureMap = ImageUtilities.GetTexture(mod, module.textureMap); } - if (module.emissionMap == null) + if (string.IsNullOrEmpty(module.emissionMap)) { emissionMap = Texture2D.blackTexture; } diff --git a/NewHorizons/Builder/Props/ScatterBuilder.cs b/NewHorizons/Builder/Props/ScatterBuilder.cs index dffcc47a..f6583c4d 100644 --- a/NewHorizons/Builder/Props/ScatterBuilder.cs +++ b/NewHorizons/Builder/Props/ScatterBuilder.cs @@ -41,10 +41,13 @@ namespace NewHorizons.Builder.Props { try { - // TODO copy what heightmap builder does eventually - heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.heightMap); - // defer remove texture to next frame - Delay.FireOnNextUpdate(() => Object.Destroy(heightMapTexture)); + if (!string.IsNullOrEmpty(heightMap.heightMap)) + { + // TODO copy what heightmap builder does eventually + heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.heightMap); + // defer remove texture to next frame + Delay.FireOnNextUpdate(() => Object.Destroy(heightMapTexture)); + } } catch (Exception) { } if (heightMapTexture == null)