Change Default Sprite Asset in TMP_Settings by code

Hi everyone,

I searched in the forum but didn’t find anything :(.
Let me explain my problem :

I’m working on multiple platforms (Switch, PS4,etc) and i need to change the Default Sprite Asset in the TMP_Settings when i’m switching platforms.
I use 1 asset by platforms because the icons is different on each.

So i have this :

When i switch platform, i want to do this for changing the Default Sprite Asset on the TMP_Settings :

TMP_SpriteAsset spriteAsset = AssetDatabase.LoadAssetAtPath(pathAsset + "Switch/ControllerAssets.asset", typeof(TMP_SpriteAsset)) as TMP_SpriteAsset;
TMP_Settings.defaultSpriteAsset = spriteAsset;

But for now it’s impossible because it’s read-only.

Anyone have a solution ?
I need to create a ticket for this ?

Thank you.

I will revise the TMP Settings in the next preview release to allow users to set this property.

I should be able to release this new version of the package late next week. In the meantime and since you have access to the source code of the package, you can change this property to change the setter. Note that changes will need to be done in the Global Package Cache otherwise your changes will be lost when Unity is closed and re-opened.

1 Like

Hi Stephan_B,

Thank for your answer, i can wait until next week ! I’m glad that there is a solution soon :slight_smile:

Hi Stephan_B,

I didn’t see any upgrade for the version of TextMeshPro, i have Version 3.0.6.
Do you know when this new version will be available ?

Thank you.

Version 3.2.0-pre.2 was released late last week.

Since discoverability of preview packages in Package Manager has changed between version 2020, 2021 and 2022, you may have to manually reference this new release in the “Project/Packages/manifest.json” file.

Be sure to update the TMP Essential Resources and TMP Examples & Extras after updating to this new release as the shaders and other files have been updated.

1 Like