How to use texture from a dynamic font ?


I’m currently working on a project where I have to draw texts on texture2D objects. I’ve search and find some information about how to do this, and I’ve been able to do it without problem with “static” font, by marking their texture as “Read/write enabled” in the inspector.

But in my project, I need to use many size of fonts and I can’t create a new static font for every size. So, I want to use a dynamic font and read from it… but I can’t, as dynamic font’s texture isn’t marked as “Read/write enabled”. I’ve tried to create a copy of my font’s texture, but I can’t do this either.

So, I’m looking for a way to read datas from my dynamic font’s texture, without turning it to a non-dynamic font (the best thing would be if I was even able to do it without copying it, so I can use the default GUI’s font for this).

Is there any way to do this ?

Thank you !

Dynamic fonts create textures deep inside Unity and these are not accessible through the API. Render your fonts to a render texture, then use those in your GUI.