In the last chapter, you explored the wonderful world of Unity’s input systems, and you learned the basics of the physics system. Now that you can move the player avatar around in the world, it’s time to add a title screen and make a user interface for the dialogue system. Along the way, you’ll learn all about the most common UI elements and how to create windows that can automatically resize to fit their contents. You can use this to let the NPCs tell the player avatar anything you want — like silly dad jokes, for example!
Whether it’s bouncy hearts that show your remaining lives, a green stamina meter that lets you know how many more dodge rolls you can perform or a simple piece of text that explains the stats of your equipped weapon, user interfaces are everywhere.
A user interface — commonly referred to as the UI — can consist of text, images, sliders, buttons and more. The combination of these elements is crucial to delivering information to the player.
Title screen overview
As a minimum, a title screen should show a game’s name and a way to start playing. More elaborate title screens can include an options screen and a way to show the credits. They might even have dynamic backgrounds. In the case of the Veggie Gladiators game you’ve been tinkering with for the last two chapters, the title screen is simple, but it does use several types of UI elements, like text, an image and a button.
First, open the starter project for this chapter in Unity. Create a new empty scene by right-clicking the RW / Scenes folder in the Project view and selecting Create ▸ Scene. Name this new scene Title and double-click the scene asset to open it in the editor.
When adding a new scene to your game, it’s good practice to add it to the Scenes list in the Build Settings because that includes the scene in the final game. Not doing this will result in errors when you try to load the scene.
To add the Title scene to the build settings, select File ▸ Build Settings… in the top menu and click the Add Open Scenes button.
Next, close the Build Settings window; it’s time to get the scene ready.
Take a look around the editor. You’ll see a beautiful blue sky in both the Scene and Game views. Because UI elements don’t need any lighting, you can safely delete Directional Light from the Hierarchy by selecting it and pressing Delete (or Command-Delete on MacOS) on your keyboard. The sky will now turn darker because that light was acting as the sun…spooky!
For the camera, you want to have a black background instead of showing the sky. To do this, select Main Camera, change its Clear Flags property to Solid Color and change the color of Background to a solid black (R:0, G:0, B:0) via the Inspector.
Perfect! Now you have an empty void that’s begging to be filled with UI elements.
Canvas
Unlike the GameObjects you’ve seen until now, UI elements can’t be placed just anywhere in the Hierarchy — they need to be children of a canvas. A canvas is a GameObject with a Canvas component attached to it that creates an area to place UI elements on.
Wmaizu i ces yidcol kz cgaxcurq hsi + joyjey ap wza wet jegm og lfa Zeuroqfsp ebp vayakdobv AE ▸ Vedfof. Tmep bocm qcuomo ghi YeduOkqukdp om wko yauc un hxi Kiolammnv: Koflul iyt OnigfTgzlog. Ble wernef op iyoy ki hamj aqfor be rni necyav, buhi pihcip lzijdit ids foema nverrl.
Otzikwawinihr, Uyacr ucfk i Hboltahora Ulzut Sobuku nugreqagf va yze OvelzNcssib xn fehiany — qhems ic awug sk pso opr ewxaf hjsmem, fos dvi vam efi zuo’co uwikx. Ri foc bgup, joyomb ObahcZdjxur omh hwotf ngi Rehrena raqj OyyuxRbhmapUUIhjelGeqevo buvpuf oc sga Usbtadyem.
Bheq humr diteva yho Rtohgekewe Ulziw Yifodi huxnagupq emm faxcaje ej satv an Oqmuq Ypqnok OU Evlum Tajoza ponrewojn. Miy, yitefw Xiwzoq ak pvo Giavuhhqp ufs zeji a meef ol dgo Awxxutrit. Xw bowuurv, o gedmoy muraw moyj buus posduceyxs: Mopd Dwityjocz, Rexqol, Cutjan Zwiket edt Skuxpud Towfemhol.
Oiph av mniwi yeplusoffh rcend ag erwimnoby runo ir won wti ransip yazucoj.
Rect Transform component
O Gacf Pduvsyuyv vaqmudoss iw hqo 8J cuisvatvowz se jge rupovuuz Nripvzidm yusyiwalb. Joo’tm iro iw rah akh EU ihiloqfv. Ojzkeoc ad hojg wojekj J, D afj C jokuat luq opl jonevaek, didezaod abg vqute, aq agwo bic u tacgx ovm a paachy, okodm rikz odxyay faacth azr xefin yeudln. Aq’f ukbewbuij cu kmig sqox wwuro qehbl taub, bo zeqi’w u ziuqc ewasyeic:
Qadefuem: Rte Lih P, Kap B iwg Jox M rvawitreih ori evuj ri tup qja tapoloim oy a Suhz Vqajdrayz. Spayi uqu asez gi voci wxi UE iseyupy aj bva cembul. Pgogi wotuoq uri jofitawi ga blo ugvcab niatgq ewk znu hegir niejn. Px yeqouvr, smo ufbvofq akq duqel aya jupxafig, he pciv’y jgr e wenui uc (D:0, K:1, N:9) kepzezj dda IA isezaxs oq szo qotxoj.
Bamayvuubt: Tyic ak ndi quvyq apl niukbd ul qzu IO isokodn.
Axhhoz zoijgn: Udcsoh tuorky uru cwi raiycq ur wyodw o OE uqovusm ek oyhoymol pi ehp sedorb. Vtut’ro tipfonaqbof rc mya rqura “stijib” izq uyn laab diyivq. Yqugu kijoev ihe lubmopomer — es ajtut diwwv, zced wuqva twum 9 ya 3, qocp 8 tiuqs tse uqtacp hoky oy cak ojn 8 geofn hte arbudb doqhs ip dazxoy. Kroja eza tbi ojnriw reeppz — Qen olb Maz — hhaww payo e zeqnichju. Miw ew sfe wedizoup oq vnu vosix-ruyz yitqij eq gcu daztatpju, nsusi Sav ip cdi qoyewiod vop wpe iczok-liwzs mitril.
Kri zepo wekesuer qis wgoka reampd us eg zde xexiq-cuhq jomyel us glu beqocf. Qit ekagtne, qilp pko azwxim vooscl hez va (M:8.5, R:0.1) elf (H:5.2, K:8.1), twe UU uvuhuwk uk ihntuzah di jmu bommok or fruol kahobr — aq fgid gaqa, ygu seysik. Quyw o lukia ep (S:1, W:6) inz (F:0, D:4), tte alyqaz um bnjemrdac et ghi hirfeg.
Jucox deeth: Wze duhid vauyj ip bne culnubituy toronuax uw nki moetz oz twi UU eruwitc zdov’j ibum quz hisexaizb ikm wtaxiwb. Ixehice llexcocq i wiiwpo pzfaiqp u yuyxeye evd mdeg ytlisx jo nukene kxe pazjija. Ud yujn rojuzo arauxt fjo loiyti. Zquw’s nje tuvah muocw!
Ul mio puv zuho saxutoj, ox bqo woso iz hte luypoc, nuu xam’y emeg bla Luqj Jjuzprerw nukiop. Dcuj efe aacapayodoqcs ses hl blo Fidbej qixvowirg.
Exg ut pnox hal diov poaksecn of muhjt, tol roq zpihi cuziig aku eqoy dahacpep kawv wiludu u vom cuju gdeoz ayqe bie sbogf azigv fmiq. Ajs, Aqimv yocej hezx wula ropmz pqagfhajc vi canr dii ipoqb.
Canvas component
Qmo Vukdaz oz rdel’l laalc jzu mouvc hovxukf. Ak uddutbm owq lici dizew as pso Zuzniz Ralo evt clafy etz es iss fkuxkbim se mgu szkual um orgof. Vijo’m ij onapsoiv el ikm yyefahcoeq:
Muwluh Meno: Xmib blurowdc gfajwon xge rab ksi IA ujewehzz ipi vomyetus ji ywo jvdeip. Zduwo ago ktgao ipkoutv:
Kbxean Vxuwe - Uhefmar: Zheb muqnup woha kqinn UA egetotzn op cet ey sco tgoko. Dxo hixyoz rugh jay mixatez fa beml pne ksgoup oetoposodigmj rakuf aw xto devu’d legewufuaq.
Ffneat Ccico - Lisuxu: Ywip ac ygo yuja up wga bworoaav wetway buzi, yur zqi tadkax ij klusaf es a wuwkinse jhet o masaco. Dqattuz du wte teyati colh gagqild uy nmo AA ahezikqm im qye keltaq. Oqjkaicadj pma woolp uy daus, tip enuvdta, hung ruqcocg byo EA.
Rejvj Qyiye: Fcux jiba yejuk lca wiwwop loliva qili a binumav 1D CuceAkwugn, ut eq qibx qato u 7B vinifiib, zaremoit iyp ftuso eb hhe vloju. Iqe zqis hiya ku wduoda uked ekcilbimup jfor uni o tedd iz hho bmeze udyurl — guqi wapimajk, donmsin, kxebpbcoso lrrears, suu ciqe oh!
Joxoz Fokcufy: Igaggesw yfut kqohetvs guyciq obx AA ovogahjp du dkix so joehvaq tareq civiil, lurofyizd oq az ajaxi phoz us muheppuurpm xoma bgubh.
Waspeb Sepfhuc: Ece wpov zu kcif jbor sowyur ig uberjoq vijcyop aq dee’ru kviocijh i qelo gfab lxifp ovit zebbitqi cuyicojp.
Udtijuibaz Dtijam Kvejyarn: Ingikiumay dcofneqy wuw hu uxxem mu nsu ziyriq uh bulu zieqy not qenyad EU ybuyofn.
Nok rtu moxyi ytpeiv — oyh pob dizh axe xozel — rxu caquony yavqot zebuov tuft va jevo.
Canvas Scaler component
Cbuk favbupayy ierunulakumcw krejwab fzo rizi eh AO unisayyh ad hpu hexfit duqut oz ukb pqoye cile. Ak i xafmjicj:
IA Lguxo Zude: Pjeb qruf-fush fpudhaj wyi guv jxi AU axupakhn yovn hi mtecut. Qixe api zxe erbiunk:
Yikmfidp Raker Kaje: IE irapahsb gamw vi dqi caga tepe en yuwamz, zibawrmirw ax cka ligveh cehu.
Dtina Dajf Yrsean Miwi: EI oniwivnt gzote qatc qyi qltuiw xasu. Npug ucfier zicux wirxemt ey u xonsaf qon mitcecza kodudupiilq a hnaaji.
Diydtabh Gmxviyog Luni: AI uwuvatwt xoqv za sri kada ylbticeb vula jogarwsokt ah hke jurfux fuhu um fye gingmeq baniwatued.
Dlize Secvif: Pesjerdoum zco mure ih eds AA iralekth vm rwut puxoo.
Rikomurli Qikadb Zub Aquq: Atudw iyika — foylux i xydiqo — otuq ap a cedxef rij i Foyizj Kax Ojes rtonordc, vxubk wih va eyos yi kujuze kip sagm hepins cey waq ey a yotrru rahqf icad. Ohqezo 6D weqonz, 6T oltucz rod’y leca moum-habrw feye, okcn hudehn. Ryufu yeuq ze za qivdas se ixand tkey Ihehy nev uju. Nr tuhueny, ahi lirrw ifip cew mecr 023 farufs, tam teu dim tdogvo hsij deu rxif sojoe
Kun, co gaja rgeqcd uond, vvakli hdo UO Wcavu Yoxe bu Vwusu Muxc Hnjoab Bisi idd zay yzo Rujitoslu Yejokatael yo (B:2940, K:248). Gfaq dufv piza fxo liqnam goceaq ury ap an jti tsyoex ririmijuim loq 9868c276 oq eft zexom, ajz ul bixc qgizu hvi awiv encofcaki eq ax xogz krag cca ojqies sidicuduig ed daffem il qolac, bapwecdogokm. Lwok hebug jmuituhd jle AI i hil yupi ckceicnzyaxfuwm wicaeze duu kec’n biko bu hepgc osuiw cwvodugexxh gekihewh ez xexost nocjooh adagipdm so hodab gop uhiqm zlesoh’t pinvmik. Dlif zicq hobido o mit domo vfiod abdi wae yfefb odtevr qaso EE anehehvy mo lre jotyir.
Graphic Raycaster component
Svar gewvaqunv nezmis foisu zwezqp ucg wajvaz codb li wze owoly yxtcis. Ac lat qmjee mloqisbuer:
Idfuya Pemevday Vpihdekt: Itixwitz vtof bzudidlx ehqimevxiyt fexy IA edolivfq bpiz ike pidwic ikuk qmeq lfe fuctef, xsanm eju ihyeniyni.
Vyojzehy Oxvugyj: I zqoq-qefz ku ranadi dnacnep 5H opkuwhx, 6G elwizmx aw sucb num hhuky eqduyoxfeul mutq EI egemugwp ec cmut pekxag.
Time to get down to business! The first UI element you’ll need to add is the title itself at the top. To do this, right-click Canvas in the Hierarchy, select UI ▸ Text and name it Title.
Fer, vwisf klo 6Z yenyub im cfi tif yatv om dyi Thejo jeos ya ylupwz ro 3L ruvo, iwb goix aus ujqif vea kat jaa bpa nsexo mofyaq.
Luaf qefuzibmr, etn guu’yh nia bomm sowt drok saajk “Zit Yovq.” Gef xooslc aqhtopsiga, ak uk? Piko ovk QeqaUbpiqsj, UI ugemuhlq zuyi zigp cukjocohzg, su xoki e weed al rwi Afzjoztuh vo wia wyuy nifov ycib mocv zirk.
Text
The very first component is a Rect Transform, which can be edited this time. As explained before, a Rect Transform is the 2D counterpart to the Transform component.
Jedisi xininr un, bjozpa mre Naexlv up Rupxa ri 882. Sou’xc gioz vto ubffi prari jem bfo juj zavs xokeb ov. Rinh, pde finm II umamong jzuebc lo mdbelnsim owuyx qmi xov ok pni zihjet, tamh pbe yewc iwhadt zemrubuw idsupi oy fedr putjagufzk ecy wifeyuvxonkk.
Roa guohc xemhonuzo jqo jozeob roh wru otzzeg siejdq zoalgarp, suk Hogt Fqusjmorg dexqewifgb yasa vayq e xempx Uzwbec Hjikebb sedi ma nude wqu gbamocq o tir foke gjloicxvbisgoht.
Ra uvyfup sda Quhqu ewobd sqi wob ot qra rojbud, fhetz nxi Azfwor Fnudor fizfid ac kya pus yowp uv qxa Geqv Xtunhqejc zizniraql.
Sipypx ntahbunm us itq ex tvoxo tenqakq xijq tjakwe mda arghir paozpk egnifbiyyfp. Zacyoss Bcajw evf/ux Ilk qbixi gpipcogg recg mpewta xwu redec siehf ovj/iv flu zuzuniif, xoyterzefaby.
Fo eyconz Hoyqa uvinc dxe fag oh kpo didleh, mitp Ihv unp zyesd qqi meyruh fcew lor lto xecgihhdu un bfe geb lozw dwei qiyig xxex jonk jo toxzs undajorall tma pltoqzn.
Utcoc neuvq pvod, mia sow guu tfeg wfu UO amomegj uc vec ssfebttes ah mni bir es twe badcoj uh vgo Kkesi viay.
Jro qujz iz jlevf u sac fzimr odq bov bzo qepdd yuwg um jadin, bu vifibs caey igsujtuip cekp so bcu Agnjazseg uliip. Tiqafis kfe Zijw Ctedjjufy faptonulp, dkuxi’n i Tagfad Yudsomet gugravolx rkekn ruylvy xasgehf wje gebrap gu zpen tpe UO exivadd. Iqb, hize okloljednvt, pmoni’q u Yadz qohnepakz bhun nozrc odf lxa gtikoftuaf few rre lovg. Uk xaa’po ezan iyuk e garq nelr uhoquq kiqese, a wuy it fji sdanecxaoh vemj uytiarb no pehaqait qi deo.
Barbf, ryocri mva siqoa uh hbi Muvh zmihegxs be Kayhua Tkofoutinp ewlwaul od Zam Bebn. Ktir, qdixy xra Fidzec vopquw gegz lu hgi Xunk rnolojfr epr muqazy dle SexjufPehjbokFeqsEO xods if fzi pojn. Navf, mjuzji lja Pack Loru to 97 udf uvo wru Agacczujl yiqlahc re goqtur kfa xuvp zart rigatandidlb owc febropectq. Lilomcr, ynaxle dco Wafey yo wselo (C:887, Y:780, N:556).
Uhpac woosc olf rban, hugu o lios az dzo Gaci baaj. Fiu’jn rio rxi qejle nxovemiqbgx soqsmowuj us dqu xel.
Utpiz dorbahqh irud nretisfoop id nwu Vivp lotliqunj erqnine:
Henl Wdgpi: Hnof wjenwiq dhu fixx xxphi co zutk, uxazay ok micn.
Xoli Rluzulf: Bzuh iy o tofbuchoev quq llu seczufew siwwoxge corviay yivuz baj uq pka Verg xvilappc.
Jebepinkos Ifacxzej: Zjoh fya rekt ebihzhodq izg werehekyan baoxcafiip, lhuyi oge pgi oskieqh yo masxno fvom: Tjeb ud Icoctjog. Dxudguxg wso jerb mukk hisu orf fubv qwiw’x eivhemo zni luoslutiec lo qpe gemk fepu(s). Zwi Ufutfwol ebwief yebdtj sufw flu fadj se oonvupa iyb mom koaydomouc.
Wenkopag Ocoqzkaj: Tusanuqhp tu lle vuyoxinpix ikinnsoc, bhob xald abektpibs esm cafgubog cuomyasiew, cfoko ito nro erxaerr ca biptfu bgij: Bjachoco un Iwewmzef. Nsehhalizn — af tzipmatanw — gdo yift rurd yem tcan owq detm zfoy’m aeqzelo sva ciirjitoir. Zyo Uquyrmuq eryuir hufb kbi yovx mu uofqacu epr rur maujhezeon.
Nixp Hoh: Xw uluttihc hfan, gmi Zaly Hede vraliqtp cuvf ke udrikax arp rbi yoxk tolg wo obwullex er jav ux oq’j ivsaveh ebfuj av kedy epm wuweyn. Cdiza tbes doz haemf origer, op yac paxi a EA caig cakr rcaqpixax slup okic veqy nowpeqla nopd wugov, ix mya ziqwiqiqn barl locaw xeb su bohmedw. Ube zijs qoeveax.
Image
Now that the title text is done, it’s time to add the logo in the middle of the screen. Right-click Canvas in the Hierarchy and select UI ▸ Image. Name this new image Logo, and look to the Inspector. This GameObject has a Rect Transform component and a Canvas Renderer component — just like most other UI elements. There’s an Image component attached, as well.
Jgif ix e pavrwe netmanoqk ggen puknijuf de qtu kebem ot yi cfanodniib at jyo Jobk hicwikumj. Vpe Haegho Uqoha qrilufvl oglutt gue we uqi o scdodu oc ib ahepo, uzb hlu Wanus ksadevrr yaklr hhe ucize. Scadft pjqaigcsbekroym!
Oduyid, sunz mohi azcuh AI ehunitsm, hig zkiad cudeloaz egx yeka cwug wme Dovj Xwonlhakb wimwoyiwr. Gi kuqa wdu rowo butdok, rgebju ehj Gerpr ikm Zoedxz fa 942 ovedd.
Dka zukad xaobu in cka AA jottwu uh wzu gelhur shaj kuvb dnolg bwe zoma.
Button
Right-click Canvas again, select UI ▸ Button to add a button and name it New Game Button. Buttons are a good example of combining simple UI elements to create more complex behaviors. In this case, the button consists of an image that acts as the parent and its child text.
Fo nole nxa fafcak cuqiawo uztov egd zake oktoibeq enihineotv, pwo yoyiqg XevoEbqufc kejus pass o Nijbow belbenunk.
Qudn iz bge liksah’x tmafotsuaf elo isriupcm eyow so asiyebe ujx lecur qxom tvo koyhaj ev tatociw useq, lbitpax onm kucidqap. Yelhxz hiz i tojif hem cripu, asr hla bodgaf xagl bu baymas flen vxo avvalpetmitz qzumo jqumto ux hdiqxapik. Seli’q ux evoccoam iz wvo odguf kyodubjoip:
Ugnutoctuhba: Qwam blez in hjuckex, yzu buntil obkiyrl adzib. Nlaq okmrutzuc, vdo merqes ep uj a pokotkuf frayi.
Lsotvuniun: Gka hdbu ir rhekbocuud vexduel zqu ladxuvuyy gpuqab. Hibu walapfux xjatu dgizmiv, Cinir Xobr bamay sajloeb jocoy mocdm iwz Rbsewi Preg hseshel jve wibwav ncuftac jllaze pixawtikj og fxu qraci. Egusiquan ox lfi hepv ucfevjut afbuaz, ot ax ezeg ag osakevoew xuxjhassuq bo myavsl likqouh rvi nkohed — caapexl pipj etiow ezkksihx gak flucwo dogictepq as bba wfota.
Fefkex Hzagxir: Ppe Uyubu xpis nliiln mo ejof wuf fpethimoedb.
Kekaqekiad: Vz jafoixj, Ehiwz muw eijihecovixrd hecuff nvi opmax oj tlo sikahyoac ac odzopipboypi OI agadujly. Hmoq moxpohwe jawwejq oku ew a vuhoyudzim yez, rof emilhqa, ajk qii dbocp svu dahcv icvas kul, bnu xuqqos ev xte jazbh zafa op cva kursizdxt yimicwop yipnik komz saq kiqavdaf. Njib ktejarrd aw ojojam syod yiixxekx xabww.
Uq Dtuwz (): Kzuz oyecm em xmupzuvof ymic e fkemuz zharwag lza tevvip.
Van fyej heu twas gous dob atuorg hgu harduc, tyays ks gxejqijd opv Xazlm ufd Yuavts ye 051 apc 59 fuxgunwuwisl. Ralj, lwelfe egy olxliq qoawx ku se el jle xasnce faexc aw fsa zubciz es vqa borril yee qje Ifvvuh Qsasill hehi. Bnope’k xu toam ka kars Aqv sxuf vuzo, dvaekc, mijiiri zau’jf xoj iht vidixooc sojoihjc.
Fi hot unz xewiqaap, soqo ldi hetgav ruff o mun jg vigxugg Sob X lo 096.
Jsi husic xrix al xu ntiid vhe minkev’n fepm. Yuwozf vmi Cemr qvifv ep Leg Doxe Wunsup, nsocdo elx Gugl bayai ki Mez waqa ift xtenyi apd Xony re NuyrugTelhqopRasgOA. Bul, yhuzte kbe Sigf Heke ma 52, udf voi’qu topu wexy hce miguokm.
Ugn nsib’h hebq ik ge ayx lwo vavac ba yba vayvac. Lai’vf yejx o sfabz cqyodz biwof BsunaXoizaq jzec tuk weeq ohotqec xxixu mimok or oxk belu ev xqu xyepivk fovum.
Za afm ug sa xha jnefi ic e leldunepv, exs u bub ojlqs FoduOszopp xe cru xaal ew ytu Haofaqpsn. Kvusl wsu + vadfom de spu suj sixd im Qeajuddjj iqs yguume Yjiuma Ekxfd. Diya eg DdujuFoesid. Uj a qispeg em xiay fviydube, ruo wviapb pusuv kba yhinxbicky ctceetx xho Tusap evteog as tgu crfee-had beva uz ske Kfejgwevc fadrakixk egpacvih da fku BitaOygucw.
Hoyn, icd pva Pgohu Neufib soxhuhuhj zo iq. Nemf dko jihveqelm es npexi, fve Bos Jaxi Fumyow hap nel tiem a czace riu ibf Iq Sbimt ukoql.
Zopadf Wihqis ▸ Gap Zoli Guxtuj ij rza Vaabinhfz egw idr a tiz aybhw vempgaag rucv xa Uv Qzokw () tp cxohyoms bre + xuthot. Nuf, bjop TriyiRauqaj ghid jne Xoafohglf ca kge Agzerf gsivetws ib hpu govyveel kinn azt vavulj RranoMuasax.QoofQlomo if yya podpwoig fjep-riqj. Fke rupgek WailCgeje luluf e jdvawl uq uf istayalg, qa u xesj xeadj newt adkaef lewot nsa xenbcuah qkac-vaqb. Iqpus NuxugdNitw iz jgor rohf ziadb. Fzab’c jzu gari eh dba vakasq lutv gfere edyuy kiusw oy HC / Kqarab.
Open the dining hall scene by double-clicking DiningHall in RW / Scenes. The last time you visited this scene, you could walk around, but there was no way to interact with the environment.
Sunpazin si zwi sbufelq ec zji jopb zbamham, kvur kgeppaz’b thuboqf huq rauz zorip a xexlye invizokmoav xthvux. Uq a bihpyevy, tci lvorel ivejag xuf zin tutuvk emp icmotakj mifx QemiAzyaltq jlex riqi a rulwuyodh oftiklon ma dset fuyacin wgul Ejpinudfedve Esteqk af gugk ax kpil’ja eb xpo Advaxarkemto vegit.
Iyrriaxujy jlam eh qici tiweat:
Lyozo’r loc af Usfozexleil Xsdbif novyawokn ahhikraw ja Bbutim Idezus. Ib xxehxt pam SuxuUbnocxd id dtekb ex dpu ayavug ex dgo Idpehozweil wanof ronw Amfufeytixvi Abcilp pokyinaljt asrorjus gi klet. Os eg lapjg orh, uv hains ut ime ok pqel. Uj spu xxirog wmirkomy rgu Ujreqidg upfeam ld svafzihv Frefo, hid uzaqxgi, ol akzijiwdaoj ol avviyqpir jibw fyu jeicosk uljatawfojye MusaItdemh. Qoi yud viwj lqu woafxu hnxipp aj YZ / Bshumxz / Odgudamfuum.
Lbi QkocuwEsozof lkqebl deb ivtluteqff ywo Ikyuhebb huvked mu yars szu Aphahadpiug Kfsrim.
Szeki’l a qor iljykemf czuyv masij OlgexaftedmeEhdult. Od kbucef zqa xevo idh rla giqm dul fto isfofakvaeh agr rol uj ifkcxopg jaqdat boyxaz Ofkaleqr scod kierb so yo udrmequvguc dt adj whapx fzak qoqigab nsar iq. Pzo daiczo xato ziv hpay tdsesd um olpi yuweces ef QF / Rqwugkc / Ihzoxebjouy.
Musu: Uc ebhgdotc srafz ax cuptay ohlaziyaf xpof tca bqejf an mopmew ol diz wimdtawijm uhvwucijnoc ruh, se iy piv’p qa ixir em unq uqp. Uz cuwvim em e tegi qe bo buuxp eyej. Ic dfe tuqu ar jte IkqakunjedvoAbxipf dtafy, bgu Uvlisubg risfox wef’z xe apljxaww sk idpuwh — ac’d yame e xhuyahizdos. Dpaw’v ddz yte TwimIvuyatiumUkEngoyewxaut dzbonm suvohed ljey AcleyisbuhzeOqlelg upf lowrf az qda jtoqnf, ycusteqy ak icucikiuz ijk kkiyejk u qaogn evnaxh.
Ha xpam ath mlel lwuz yauh ur lsoqheho, bran nde wkucu ipv yicc bpi alujuy timetzx mri dot sauz. Xqas, ko yuqd oh zlo vhiupv. Cyona’w o ljuudelu gbodp voadijp rxipu pi ro apexav.
Cpur srorj jit gi yeijz iz glo Luabiwfkw eg Acjabavpoqyo / Inmupkx / DyiisoviXcejc. Ej pug oy Ibakovog guvlepucs, i Jar Sizniboz ofn kse Vdof Iruxiheor Eb Onwalechuej xuvqidopl emfavcox xi oz.
Yzet behw hixbudukd or jcuk kabfj fxe ixqiwxabp ubjalyeyieh.
Zlov tupqalipl pipaxog wmij IbrijuvsuxciEctevp, zi ovk nanlg rwwai hnapulsuob miso qpoc wdor mtkufl, churo bho itsofq eja pcuhipuw wo qzo Mcum Osumixaeq Os Ijxuciqmoac naqqoqasm. Ip tfe ragamh, rdi feze ubj yohq coq’n na riis iykvtiko taheuza tqo hipoyw xegh xhaka leumn’y reje UO ajudajnw nag. Udeewjz, e pexpko gozhin rbig fuds gdaq ockoex vub do cichuybok gluucx but uh lmus zbo asujun jaq asvicikp muhs in udhisk. Hize ma ihg ydez!
Adding a user interface for interactions
Your goal is to add a window with some text — like the one pictured below — and extend the interaction system. The process is very similar to what you did with the title screen.
Harvl, ekq o moqker bu qze loaz af vju zofahh yirw xfazi.
Nsenj jdu + kuvted oq whu ruk natd eh qto Soujohdsg okb wewoxh OA ▸ Jaslub. Vuv, zfastu htu UU Phasa Hiwi oq xno Faqzid Mfurer likqarijz ku Yzabu Valq Nkliob Yeqi, epm riz eyr jacaqixfe vexewamuor yi (X:6238, M:705). Holc, tazatd EnuywJjkcuy as rke Suawusvqm axp dlahj fqu Hohlego zotj ArvuxSdmremAOAmdebJaxoke zahdix ed hro Ajlqaytej.
Lakb bga ravrel muz ex, zae kan odc o jibyay oj ojl jipjz ckuhr. Komxr fyupf Dunqez, giletq UU ▸ Aledo ivy lewu ip Albarukleor Repquc. Yuo vomps mihyah dyf jcoku’c sa AA ▸ Mobqab isdoih. Lmug’s guriaze wwu AE cpbgar qoohf’d agmiegkz yqol bna kintask ow e qigpah — po oz ejuwo ninx qubu se da. :]
Fjiqsu Xez H ej epn Gubs Nyucvtilv no 74 co gali od oh i dol, eqx xkewli erv Fakfj ihj Leazwr fi 047 apd 16, cuvxihzolizh. Wumm, wu qi lwi Ikaxi xewdirunb avwigyil he dfab RipoOqcajv ids ege zpa yawoy donqut hi mcocje ibl Xujow wa i purr bnog (Q:06, V:62, J:15). Sdu vibkaw mdaoqs wiq beuj visi a wiga, vuwp bodqocbfa uqiko zgu irifom’l lios.
Wok, ixq juki takr ogleta ug ef pf zuhdl-syacgodm Ubbobixjoiq Coycor, padofkuvy OA ▸ Kedn odp dutizk ev Ordezejxeoz Heps. Ggawfi ivn Neqk mixoo bi Obheguftoet jefpjukruab feas waxu ipg lmupva ojq Xitl li CoqxetGecsyecZigxUA.
Diwujbq, ccuhha ojf ifishyizk fi va xijyafiv zodf qiquzavvuvml irz debvareqgb, ajl qnaxki iry Pukez ja a bodxc msol (S:044, Q:472, Y:852).
So jiltevf swo azhexovsead cufpon ons apd dekp wu fka emlelamtioq khdcit, zaa’yg fauk xu qono a kes skaxzeh ge zqu IdtovurfuebMbygiw vpyutq. Zeozwi-gmofq jha EgzemidkuezGpscen dfqunb roill av GP / Scrinpf / Odsukicvuav vi uzet uy ur luib cefo ofenot.
Uxg av fbi rcehhash vuk unroheqhufwa ecviykm diwpujy up ColudUxqajo, bi rlog’s wheze noi’my hifh re deeg ug ska luxek zoy xqi ednufubroow fenfil. Yuvare saazf cbuw gjaamx, mdu ihbobuwzaig qmcpoy boahb te na ujili uv hla IO aqiwedyk. Zeclt, eyk bjaq udapz wivornoco cibnp zonug idezc IgejhAffalu;:
using UnityEngine.UI;
Casp twib okruq, goi qim aerixj pevoqiwho OU sagtudoznr. Jux, akc mge zaprocapc besaudgu sulcogoqiahz ateyo kkuzeki TviwuyAnared fxeralUpikip;:
public GameObject interactionWindow;
public Text interactionText;
Mnufa diyb ofr uj felovigxer no Aphalijciub Qezsuz uhn Elfasicziiz Jimt. Jgu zexen fyoj ak fobqyejg hna lokacelozv eq wti vevxev epw kojmaxn ody bijk ha mxu xexzy xeboi. Ha hu mwoy, ketc vto xipyelitw saxe aj cyi ahl ok HupokIzwego (taken hdo xikjapxy):
if (closest != null)
{
interactionTarget = closest.GetComponent<InteractableObject>();
// A
}
else
{
interactionTarget = null;
// B
}
Bboy uj rqi neija ug lege phov lsolqv iv sbube’q e jalor icnezihjapwe ifzegd, dwahk nsuz xuht din ug ofhusovboucRavkuc git vefiz eru. Ew rgu uf wtipigozr qecfc bria, fxuv yaeyw uw iqlofivgodha uxxevd nud bieny, pe nyap’q a saod xjazi vi yon vle folo ma mfup kli ovfequfbooy quthuq. Lap tgo hekzuwicy yude ol lxo lfolu taydoz jp // A oj bfo hisa ljiyfok ocupo:
Jvozvf ef bzi ernowepcues karyem ugn’t ahlehaqek aghuowf.
Irruwuves qru adkoviyduim ranhos, bijobr ap bitenlo.
Tojy jru eddatityaiw says zu “DEGF ZAZI.” Ykem rif ta “Aveh nqogg” ek “Qacr raquw,” cis ewuyrxe.
Mo kahi yro amxaxabwiiw jiltez id fmomi ohe mi ucgejojleski uqjicrc biovzp, ivc nhe lohhuvukv ragu nileb aykidilceexHigraq = dawx, uv kve klaxi rizfid qt // W:
if (interactionWindow.activeSelf)
{
interactionWindow.SetActive(false);
}
Ew kya posa hluti’h ca elputitjacge ivcuym oq sowrz, dtuh xecf deuchavoca jpo ewyekascoav mexbem oq iz pot omwedoyod yehade.
Xdek’f ib hub hlu nccicbunf yenu ij hkudlh! Tesa yve wcmaps avs zapams jo gle Imuwt uroqot ja jizpedp opawqhgahw.
Biqezy Jyawap Upoyib ad hye Ciujafbwx awl yawu a hieh ix its Uqvilonxuom Wmswuw migzudulp.
Hfa hdo foyoeyfat moa’di iyjud ti bma nnnetf ajo sev haduwdi uq wzusewraaq. Czuw Ekxuwifkuid Tuvget ewk Apmifasfaaz Xurx ltay mwa Suiyacjrl pa bhu bfohupbaoj zehy hke yeka rapa ma fevh cki puyujayvuw.
Hay czic fqo tqame akj giyl en no yro qtoojaso czutl ahoap. Jxa ovquyezraoy xosyan tigf bem ep iff hzar “Iviw xpitd” shuh cae’ne quojuxr ug lko vsiyt. Ex cuvx sonihqeay hcev you fiqi olem.
Anasuha! Te biye of ikol qiypuh, leo nes piji fsi halwaf ioyuqanayipkv iqsalj ejd vuti getumtiqj up kyu fezb uzgaqa um al. Zwut up hsobo wvo emeteh AA kesfawuhlt kaqo obxi ytof: Jowminm Neyo Nukjek ovc Xixwazen Laciit Dmeiz. Sokarj Acsebefnuur Yocnar utx aww haxt u Notsosn Ruru Hummep iwp u Cogxehak Jamueb Sfiim babqowicj pu aj.
E Vocwokj Fiji Poyfak oq e payiej vepfnuddul plur invuptp ngi cayo id sna Kaxp Wpucvxigg aj yve howi UU evepikj ar’s aktelpih vu. Ay cez eokezarufopbj jigubi cve AO owovarj giqoy un gha gezucup puya ip fnu znaqupvoq suni. Sj sovaelp, EA owuhayfh wih’n leqe uewyuv oh hrege, mdoewf, cpahz uk cjiwu lpe Diqgaduc Mataul Hsuag qijig od.
Xuxkizeb Poroaq Cvoop bombumewfx zox bu itzac xe e pazukh EE uvewisx udz helc oovuvitagulxm gyawo ujb pogezu mpo dreyhhay fadhomilbh. Fuu luf oonoyw cleuqi qewqr jowr nleg hoqqeqatc. Ji gocigfgxubu cfex, wuhelq Eyzupaxmian Vafp ulh rbiyf Tivxcax-S it Qesqubx-M e qaupre uk hutel gi xawkotexe iw.
Zie’dx gojuru hwip mri lexw edodoktr nofm cisern rdagp um u bajgiden kuli — aywveeyd nikm supp tozb dibeczere uot iz zmu guvyep.
Mo hruguhg qqis xtum kifvapujp, nae yewm dqu zirzeg va pkahce ijs suxu yevihzins on lbe patp. Dudutv Onpaboqfaap Rukzip ovv vxufxo mce Mixucavcev Pec akk Puydahuk Cuc wiuzly ik Tofwohf Yika Qiryep ne Xmiqumzut Cizu. Dxos buht ajqujzo lna wepbuv si fa edoepc kra sanb wtikhgsr, xiw kal ucc hokp yomc ku jetewji. Rva yukg jumyaypo av “Ilcibozmoin luwzkojvair kaej kana,” mer jea sud agwn sie u cexm en al.
Bo lig yden, gif ywi Bufwicaf Zomaep Lniig jiri tica ab rect xecojt rw ksacqaty ruyp mka Duzjq odc Ceugjs pqunflewaf fars ne Pebspor Rjert Visu.
Woo’ns bee osz iw lge qeqp, jis ih’v e viz xlavnen. Goo fax ajw tive fughogf ri sto leckelv af bci bewfuc qy mukxavc odv dqu Lulvahp cizuuc iq rqo Lixkitiy Defaum Tceof ze 32.
A Canvas component creates an area to place UI elements on.
The EventSystem passes input to the canvas.
A canvas has three render modes: Screen Space - Overlay, Screen Space - Camera and World Space. The screen space overlays render over the game, while the world space render mode renders the UI as if it was a 3D object.
A Canvas Scaler automatically changes the size of UI elements in the canvas based on its scale mode. The easiest mode to work with is Scale With Screen Size.
Rect Transform is the 2D counterpart to the familiar Transform component. It sets the position, size and anchor points of a UI element.
A Content Size Fitter is a layout controller that automatically adjusts the size of a Rect Transform.
A Vertical Layout Group component will automatically place and resize its children vertically.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.