Search Unity

TextMesh Pro Runtime update of spriteasset not updating final sprites

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by starmindfr, Aug 8, 2019.

  1. starmindfr

    starmindfr

    Joined:
    Nov 7, 2016
    Posts:
    34
    Hello all

    I am using Texh mech pro UGUI to display text + custom icons from a sprite asset liked to a sprite sheet form a sprite image (single)

    This works fine.

    As i want to add new icons (customs) to the Sprite image without to send all player a new game release i tried to updload and update the source price but it allways fail :

    - direct download of the sprite .png to a game components :
    sourceicones.GetComponent<TextMeshProUGUI>().spriteAsset.spriteSheet = newsprite
    This show new icons when i open the Sprite Asset in editor with a "type mismatch" but i see the icon in the preview list. Then using <sprite=22> show nothing

    - using asset bundle to download a bundle of the sprite imported in unity with all the settings / atlas :
    sourceicones.GetComponent<TextMeshProUGUI>().spriteAsset.spriteSheet = newspritebundle
    This dont show any issue the spriteasset show correct link no mismatch but same end the sprite dont show using <sprite=22> all others sprites are ok


    So is this the good way to do it ?

    or should I pack another bundle, the whole sprite asset ? Any other method to force the use of the new spritesheet ?

    or could I in any way point this icons list image dynamicly to downloaded asset on device ? (i use android and standalone pc / linux)

    Thanks
     
  2. starmindfr

    starmindfr

    Joined:
    Nov 7, 2016
    Posts:
    34
    edit : seems way to do it is to use instead the .fallbackasset to add on the fly new content. In editor the refresh is not obvious but running the project seems ok
     
    Last edited: Aug 10, 2019