Jump to content

How to write text to a Texture2D?


Recommended Posts

A bit stumped here.  I need to be able to write some text to a Texture2D object (it's a graph, i want to put some text into the graph)

I haven't found anything useful as yet (still looking), but was wondering if anyone has any suggestions.

What would be really neat is if I'd be able to write the text in a curve (ie:  around the circumference of a circle)

Thanks in advance

Link to comment
Share on other sites

On 8/22/2018 at 8:19 AM, linuxgurugamer said:

A bit stumped here.  I need to be able to write some text to a Texture2D object (it's a graph, i want to put some text into the graph)

I haven't found anything useful as yet (still looking), but was wondering if anyone has any suggestions.

What would be really neat is if I'd be able to write the text in a curve (ie:  around the circumference of a circle)

Thanks in advance

I can't help you with curved text but I can give you a solution for straight text.  Have you considered putting a textmesh pro over top of it, much like what I do with my idiot lights?  They're completely transparent and you can select different sizes/fonts and change the text at runtime.

The only other solution that I can think of, if this is a UI element, just put the text in the UI and change that at runtime.  You could move the transform around a bit in the UI at runtime if placement is an issue.

Otherwise, you're going to get into manipulating bitmaps, canvases, brushes and fonts.

Edited by Fengist
Link to comment
Share on other sites

2 hours ago, Fengist said:

I can't help you with curved text but I can give you a solution for straight text.  Have you considered putting a textmesh pro over top of it, much like what I do with my idiot lights?  They're completely transparent and you can select different sizes/fonts and change the text at runtime.

The only other solution that I can think of, if this is a UI element, just put the text in the UI and change that at runtime.  You could move the transform around a bit in the UI at runtime if placement is an issue.

Otherwise, you're going to get into manipulating bitmaps, canvases, brushes and fonts.

I'll look into that, but if it isn't curved, it isn't really useful.  I've solved it for now by using colors intelligently.

Thanks

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...