Open Gordon-Dry opened 4 years ago
Sorry, I don't know why it's happening. FAR uses textures from the GameDatabase so the issue might be with KSP, and of course it's not reproducible on my machine. Can you try FAR from https://github.com/dkavolis/Ferram-Aerospace-Research/tree/logs and overwriting the icon path with
@FARConfig[default]:FINAL
{
@CONFIG[textures]
{
%iconButtonStock = <relative to GameData path to icon image without extension>
}
}
and see if a different icon works? Default FARConfig
If you use DLL from bin/Debug
the entire FARConfig
will be dumped to log in main menu.
I don't need the @ because the FARConfig.cfg already got the correct paths. But the release got no FARConfig.cfg - that is the thing I guess ...
I will test the build from the "logs" repo next session - as is.
Hmm. Now I loaded the game and as I went to the R&D the UI became unresponsive, I cannot leave R&D and this is spammed to the log:
NullReferenceException: Object reference not set to an instance of an object
at FerramAerospaceResearch.FARConfig.get_Item (System.String key) [0x00005] in <1800ba8bb55344948185fec5b0ff0f00>:0
at FerramAerospaceResearch.FARConfigParser`1[T].get_Instance () [0x0000a] in <1800ba8bb55344948185fec5b0ff0f00>:0
at FerramAerospaceResearch.FARDebugAndSettings.OnScenarioChanged () [0x00000] in <1800ba8bb55344948185fec5b0ff0f00>:0
at FerramAerospaceResearch.FARDebugAndSettings.Update () [0x00008] in <1800ba8bb55344948185fec5b0ff0f00>:0
(Filename: <1800ba8bb55344948185fec5b0ff0f00> Line: 0)
Do I really HAVE to replace the binaries from those of the bin/debug folder?
Or is it something else?
Well, this time I used the debug binaries and the log spamming already started as KSP reached the main menu... I guess it already did it like that the last session but I only recognized it after checking the log as I was stuck in R&D.
After loading the save there is no FAR button at all. Before it was a blank button. Now it's none.
Ok, the latest commit should solve the issue. Some mod was modifying AssemblyLoader.loadedAssemblies
while FAR was iterating over it.
Button is there again, no log spamming - but still no icon on the button. ;)
Can you check if the button texture works on a clean KSP install only with FAR and dependencies? Might be a mod interaction
With just
FerramAerospaceResearch (dev/logs)
ModularFlightIntegrator
Squad
ModuleManager.4.1.1.dll
and starting a new career test save - no icon on the button:
Log: https://www.dropbox.com/s/3kqyq6p7m39frxn/player.log%20and%20stuff%202019-11-06-01.zip?dl=1
Ok, I think I know what's happening, try now e0248cf38d396700a278c3dcce54653525db580b
With all my mods - no icon: Log: https://www.dropbox.com/s/cz3n326bqwdy0kw/player.log%20and%20stuff%202019-11-06-02.zip?dl=1
With the minimum install environment and a new career - no icon as well (see pic above). Log: https://www.dropbox.com/s/x40qouesh38q3uu/player.log%20and%20stuff%202019-11-06-03.zip?dl=1
Still no button. Log of modded game: https://www.dropbox.com/s/dcwkm4w3qsram8c/player.log%20and%20stuff%202019-11-06-05.zip?dl=1
Well, the texture is loaded and exists in the GameDatabase
so I'm not sure what is happening. My only other guess is somehow corrupt image file.
Can you check if the icon shows up once in main menu with DLL from https://drive.google.com/file/d/1bBlSc4IeXqYr4VgYcpS7tLH-kB01se7d/view?usp=sharing?
The only difference is I added this segment of code immediately after call to ApplicationLauncher.Instance.AddModApplication
var go = new GameObject("Image");
go.AddComponent<CanvasRenderer>();
var rectTransform = go.AddComponent<RectTransform>();
var image = go.AddComponent<Image>();
rectTransform.SetParent(MainCanvasUtil.MainCanvas.transform);
rectTransform.position = Vector3.zero;
image.sprite = Sprite.Create(icon, new Rect(0, 0, icon.width, icon.height), new Vector2(0.5f, 0.5f), 500f);
If there's still no icon, I'll look into loading the image myself.
With minimum environment:
I would say this is a "nope".
Log: https://www.dropbox.com/s/h1yb2dionrz64rb/player.log%20and%20stuff%202019-11-06-06.zip?dl=1
btw this .dll did not create an additional CustomFARConfig.cfg directly in GameData
This time I'm loading the texture myself but you don't have to wait till main menu https://drive.google.com/open?id=1bBlSc4IeXqYr4VgYcpS7tLH-kB01se7d
using System.Collections;
using FerramAerospaceResearch.FARUtils;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
namespace FerramAerospaceResearch
{
[KSPAddon(KSPAddon.Startup.Instantly, true)]
public class ImageLoader : MonoBehaviour
{
private void Awake()
{
StartCoroutine(Test());
}
private IEnumerator Test()
{
using UnityWebRequest request =
UnityWebRequestTexture
.GetTexture($@"file:///{FARConfig.CombineGameData("FerramAerospaceResearch/Textures/icon_button_stock.png")}");
yield return request.SendWebRequest();
Texture2D tex = DownloadHandlerTexture.GetContent(request);
FARLogger.Info($"Testing image loading from {request.url}");
var go = new GameObject("Image");
go.AddComponent<CanvasRenderer>();
var rectTransform = go.AddComponent<RectTransform>();
var image = go.AddComponent<Image>();
rectTransform.SetParent(MainCanvasUtil.MainCanvas.transform);
rectTransform.position = Vector3.zero;
image.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f), 500f);
}
}
}
Better late than never (I wanted to do something else than just troubleshooting this issue):
Try dev branch and FARConfig.cfg for options, works with MM. Add the .png
extension to texture url and change its loader to default
if you have issues with textures not loading.
Note that there's an additional DLL now for adding and testing new features directly in Unity editor.
See and
Log: https://www.dropbox.com/s/w8z9jco9xlljjv6/player.log%20and%20stuff%202019-11-05-02.zip?dl=1