Search Unity

How do I change the font in C#?

Discussion in 'UI Toolkit' started by Brainshack, Aug 29, 2020.

  1. Brainshack

    Brainshack

    Joined:
    Mar 1, 2013
    Posts:
    33
    I got it working in Stylesheets but I dont know how to use the style object of an element to change it's font by prociding a url() like you can in USS.
     
  2. jonathanma_unity

    jonathanma_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    229
  3. Cliverus

    Cliverus

    Joined:
    Sep 1, 2020
    Posts:
    1
    You have to stop using the console if you want. The console can only display all text in the console with the same settings (some consoles allow you to paint certain characters), and these settings can be changed in the console settings. In Windows, you can right-click on the title bar and select properties, but if you want to do this from C++, you need to search the Windows API for things that deal with the console. You will not be able to change the font of only certain text.

    In fact, at this point, you should look into some application framework and use rich text control in a real window rather than in a console. You can also find more information here - https://merehead.com/blog/user-interface-ui-design-trends-2021/

    Best,

    Martin
     
    Last edited: Sep 5, 2020