Unity3d GUI font settings

Source: Internet
Author: User

1 usingSystem.Collections;2 usingSystem.Collections.Generic;3 usingUnityengine;4 5  Public classClick001:monobehaviour {6      Public BOOLWindowshow =false;7     PrivateRect rect =NewRect ( -, +, Max, Max);8 9      PublicRenderer rend;Ten  One      Public intfontSize; A      PublicFontStyle FontStyle; -      Publicrectoffset margin; -      Publicrectoffset padding; the      Publicfont font; -  -      -  +     voidStart () -     { +         //Get renderer Components Arend = getcomponent<renderer>(); at     } -  -      -     voidOngui () -     { -  in         //Window ID window Size window callback (define in-window view) window caption -         if(windowshow) to         { +GUI.skin.window.font =font; -GUI.skin.window.fontStyle =FontStyle; theGUI.skin.window.fontSize =fontSize; *GUI.skin.window.margin =margin; $GUI.skin.window.padding =padding;Panax Notoginseng  -             if(Gameobject.tag = ="Pipe") the             { +Gui. Window (0, Rect, Onwindowone,"Piping"); A             } the             Else if(Gameobject.tag = ="Stand") +             { -Gui. Window (1, Rect, Onwindowone,"brackets"); $             } $             Else if(Gameobject.tag = ="Base") -             { -Gui. Window (2, Rect, Onwindowone,"Base"); the             } -             Else if(Gameobject.tag = ="Valve")Wuyi             { theGui. Window (3, Rect, Onwindowone,"Valve"); -             } Wu         } -          About     } $  -  -     voidOnwindowone (intwinId) -     { A  +  theGUI.skin.label.font =font; -GUI.skin.label.fontStyle =FontStyle; $GUI.skin.label.fontSize =fontSize; theGUI.skin.label.margin =margin; theGUI.skin.label.padding =padding; the  the         if(Gameobject.tag = ="Pipe") -         { inGui. Label (NewRect (Ten,Ten, $, +),"The current window is a pipe"); the         } the         Else if(Gameobject.tag = ="Stand") About         { theGui. Label (NewRect (Ten,Ten, $, +),"The current window is a bracket"); the         } the         Else if(Gameobject.tag = ="Base") +         { -Gui. Label (NewRect (Ten,Ten, $, +),"The current window is the Cradle"); the         }Bayi         Else if(Gameobject.tag = ="Valve") the         { theGui. Label (NewRect (Ten,Ten, $, +),"The current window is the valve"); -         } -  theGUI.skin.button.font =font; the         //GUI. Label (New Rect (10, 10, 140, 40), "Current Window ID is" + winId); the         if(GUI. Button (NewRect (Ten, -, the, -),"Button 1")) the         { -Debug.Log ("Current Window ID"+winId); the         } the         //define the scope of the form to be active This function does not know why it is not implemented the         //GUI. Dragwindow (New Rect (0, 0, 10000, 10000));94     } the  the     voidOnMouseDown () the     {98         if(windowshow) About         { -Windowshow =false;101         }102         Else103         {104Windowshow =true; the         }106         107     }108}

Unity3d GUI font settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.