KittenAqua/TrainworksModdingTools

Potential problem with mapnode related function

Closed this issue · 3 comments

https://pastebin.com/zwpT5WkS

Recent issue, Custom clan can load, is listed in the logbook.
But unable to launch the clan since the new controller update. Previously was possible to launch a game prior it.

With my limited knowledge, i presume that a map node wasn't registered properly.

Don't quite know what exactly it's doing, but the problem is here:

var images = this.MapIconPrefab.GetComponentsInChildren<Image>(true);
List<string> spritePaths = new List<string>
{ // This is the order they're listed on the prefab
this.EnabledSpritePath,
this.EnabledVisitedSpritePath,
this.DisabledVisitedSpritePath,
this.DisabledSpritePath,
this.FrozenSpritePath
};
for (int i = 0; i < images.Length; i++)
{ // This method of modifying the image's sprite has the unfortunate side-effect of removing the white mouse-over outline
var sprite = CustomAssetManager.LoadSpriteFromPath(this.BaseAssetPath + "/" + spritePaths[i]);
if (sprite != null)
{
images[i].sprite = sprite;
images[i].material = null;
}
}

images now has length 6, while spritePaths only has Count 5, so there's an index OoB.
Maybe someone who knows how to inspect the prefab (or which one is being referred to here) can look into this. :)

Apparently the selection outline image ended up in there for keyboard / controller support.
It's the first sprite in the list, so just adding another entry to spritePaths should do it.

I'm going to close this since there was PR that mentioned that it fixes this issue and I don't see this happening anymore.