Jump to content

Is it possible to draw UnityEngine.UI.Text into IVA?


mahanako

Recommended Posts

Hi, I'm trying to display some flight information in a cockpit or command pod IVA view similarly to how it's done with the speed. I know, there are awesome projects like the RasterPropMonitor and more to get sophisticated nav instruments, but before I dive into that, I'd like to keep it simple first. Though I'm not new to software delopment, I'm pretty new to making a KSP Mod.

The velocity indicator, which you can see inside every cockpit or command pod clearly uses a true type font, so I thought, I might place a UnityEngine.UI.Text object at some specific place in the IVA view.

My question is, is that possible and if yes, how do I do that? And if no, what else can I do to just put some text into the cockpit?

Thanks in advance!

 

Edited by mahanako
Link to comment
Share on other sites

  • 4 weeks later...

Well, I kinda answer my own question, hoping this helps others, too. After I have looked through various projects, I have found the InternalText class used in MOARdV's Avionics Systems project and it worked in my case drawing text floating in the cockpit. This class seems to be the KSP equivalent of the UnityEngine.UI.Text.

InternalText t;

...

t = InternalComponents.Instance.CreateText(
        font, // eg. "Arial"
        fontSize, // in IVA 0.15 gave reasonable size
        transform, // I used some random component's transform found in the cockpit
        text, // the actual content string
        color, // eg. Color.White
        wrap, // true or false
        align); // eg. "TopLeft"
        

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...