RoomFinder

RoomFinder

533 Downloads

Request Resolution Games to fix a critical UI bug when rendering non-standard cards.

orendain opened this issue · 2 comments

commented

Note: Should expand on this.

  • At some point, cards get rendered by Card2DGUI.RenderAsAbility().
  • The argument to that method is a CardUIModel, which includes the Ability that it represents.
  • The method calls CardArtTextureArray.GetTexture(), passing in the AbilityKey to get the card texture for.
  • CardArtTextureArray.GetTexture() references a list of previously-created art textures it has created. Several abilities even get fallback textures (e.g., LetItRain, LastCrusade, etc.) However, not all abilities are fed through this process, so those abilities have textures missing entirely.
  • Since CardArtTextureArray.GetTexture() tries to reference a non-existent collection value ... catastrophic issue. Neverending loop of render retries, resulting in what appears to be a stuck UI render update, but really an endless stuck loop.
commented

Ah! Dang, yeah, sorry about this - this issue is already fixed in our master branch a couple weeks ago, but 1.14 (the 2d release) was already branched off as a stabilizing branch by then, so the fix didn't get in. The fix will be in 1.15 though!

edit: and just to clarify what "the fix" is, this is the old code, in 1.14 today:

// used in 2d code
public static Texture2D GetTexture(AbilityKey key) {
    return cardArtTextures[key];
}

// used in VR code
public static void SetTextureFromArray(AbilityKey key, MeshRenderer mr) {
    int index = 0;
    if(keyDict.ContainsKey(key))
        index = keyDict[key];
    else if (keyDict.ContainsKey(AbilityKey.Invalid))
        index = keyDict[AbilityKey.Invalid];

    MaterialPropertyBlock props = new MaterialPropertyBlock();
    props.SetFloat("_TextureIndex", index);
    mr.SetPropertyBlock(props);
}

(they're different code paths since the way they're rendered is super different)
the VR code has a "fallback" code path, using the card art for AbilityKey.Invalid (which is the blue shield-looking card art, I'm sure you've seen it before, haha). The 2d codepath has been changed to:

public static Texture2D GetTexture(AbilityKey key) {
    if (cardArtTextures.ContainsKey(key)) {
        return cardArtTextures[key];
    } else if (cardArtTextures.ContainsKey(AbilityKey.Invalid)) {
        return cardArtTextures[AbilityKey.Invalid];
    } else {
        throw new Exception("Card art texture missing key " + key + " and has no fallback texture");
    }
}
commented

Thank you @khyperia! Closing as fixed thanks to you and the RG team!