|
Another one that should be really easy, but which is mysteriously elusive to me. Okay, so I have imported a custom font through the TTF Importer, which was very easy. Now how do I reference that font through code in order to actually tie it to some custom GUIStyles, etc? GameObject.Find nor GetComponent seem to be the right thing.
(comments are locked)
|
This is just creating an empty font, yes? Unless I am misunderstanding something. I want to find a reference to an existing font that I have already imported through the Unity editor -- but I want to find access to it in code, so that I can do essentially what you are describing in your second two lines. That part is straightforward, but on that first line of your code I want to find a reference to an existing font rather than declaring a new, empty one.
Mar 17 '10 at 12:43 AM
x4000
@x4000: It's not creating a font, it's creating a public variable that you use to reference the font. (I forgot to mention the part about those being public variables. ;) ) You can drag the font you want onto the public variable.
Mar 17 '10 at 01:29 AM
Eric5h5
Ah, okay -- the public variable with dragging through the interface solves it. That's good enough for making an ongoing reference I can then use later. Thanks!
Mar 17 '10 at 02:26 AM
x4000
(comments are locked)
|
|
Place the font in the That is really helpful, actually, but not quite what I am looking to do. In this case I already have the font imported just fine into the game, but I am looking to access the imported version of it that I can then render. In other words, it is called "Regular" as a font. But, I can't seem to set a Name for it in the editor that I can see (a lot of grayed out controls), and I don't see any methods on the Font class for finding a reference to an existing font. I see how GameObjects can be looked up, but that does not seem to work for fonts...
Mar 17 '10 at 12:40 AM
x4000
(comments are locked)
|
