+ All Categories
Home > Documents > LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version...

LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version...

Date post: 15-Sep-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
88
Localized Dialog System for Unity – Page 1 LOCALIZED DIALOGS & CUTSCENES - For Unity. www.unitygamesdevelopment.co.uk Created By Melli Georgiou © 2012 - 2020 Hell Tap Entertainment LTD
Transcript
Page 1: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page1

LOCALIZEDDIALOGS&CUTSCENES-ForUnity.www.unitygamesdevelopment.co.uk

CreatedByMelliGeorgiou

©2012-2020HellTapEntertainmentLTD

Page 2: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page2

Table of Contents

VersionHistory...................................................................................................................5InstallationandSetupGuide.......................................................................................10

LegacyLDCUpgradeGuide..........................................................................................11Setup.................................................................................................................................................11UpgradingYourScripts..............................................................................................................12CleaningUp.....................................................................................................................................12

AboutDialogs...................................................................................................................13AboutDialogControllers...........................................................................................................13AboutDialogScreens..................................................................................................................13

AboutDialogLocalization............................................................................................14Introduction...................................................................................................................................14LanguageDetectionModes.......................................................................................................14SupportedLanguages.................................................................................................................15

SettingUpADialogScreen–DialogsTab...............................................................16Introduction...................................................................................................................................16DialogStyles...................................................................................................................................16DialogProperties.........................................................................................................................18

SettingUpADialogScreen–The“Title”DialogStyle.........................................20

SettingUpADialogScreen–The“IconGrid”DialogStyle................................21

SettingUpADialogScreen–The“Logic”DialogStyle........................................23SettingUpADialogScreen–NavigateTab.............................................................24MainOptions..................................................................................................................................24TheLastDialog..............................................................................................................................25NavigationCallbacks...................................................................................................................26

SettingUpADialogScreen–ActionsTab(GameObjects).................................27

SettingUpADialogScreen–ActionsTab(Background)...................................28SettingUpADialogScreen–ActionsTab(Actors)..............................................29

SettingUpADialogScreen–ActionsTab(Audio)...............................................30SettingUpADialogScreen–ActionsTab(Tokens&PlayerPrefs)................31AboutPlayerPrefsandLDCTokens........................................................................................31SetupUnityPlayerPrefs..............................................................................................................32SetupLDCTokens.........................................................................................................................32FileManagement..........................................................................................................................32

SettingUpADialogScreen–ActionsTab(Localization).................................33

SettingUpADialogScreen–ActionsTab(3rdParty/uSequencer)............34SettingUpADialogScreen–ActionsTab(3rdParty/RT-Voice).................35

SettingUpADialogScreen–LocalizeTab..............................................................36DialogLibrary/Cast,Scenes,andButtons............................................................37SettingUpAnimations................................................................................................................37AccessingtheCastfromtheDialogScreen..........................................................................37

Page 3: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page3

DialogUI-Settings.........................................................................................................38Transitions......................................................................................................................................38UIOptions:.......................................................................................................................................38TextEffects:.....................................................................................................................................39InputOptions:................................................................................................................................39FileManagementOptions:........................................................................................................39Miscellaneous:...............................................................................................................................40

$TokenInjectors.............................................................................................................41HowToSetupAToken................................................................................................................41HowToUseATokenInADialog..............................................................................................41

@StyleInjectors..............................................................................................................43HowToSetupACustomStyle...................................................................................................43PropertiesOfAStyleInjector...................................................................................................44HowToUseAStyleInjectorInADialog................................................................................44HowToUseStylesAndTokensInADialog..........................................................................45

@SystemInjectors..........................................................................................................46CadenceKeywords.......................................................................................................................46TypewriterSpeedKeywords.....................................................................................................47AutomaticScrollingSpeedKeywords....................................................................................48

FileManagement(Save/Load).................................................................................49FileManagementExplained.....................................................................................................49DialogActions................................................................................................................................50AdvancedImplementations......................................................................................................50

LDCAPI-CommonScripts...........................................................................................51

LDCAPI–CoreFunctions.............................................................................................53LDCAPI–BuildingDialogs..........................................................................................55Step1–TheCoreTemplate.......................................................................................................55Step2–Introduction...................................................................................................................56Step2a–DynamicNextScreen................................................................................................56Step2b–DynamicOne-ButtonScreen..................................................................................57Step2c–DynamicYesOrNoScreen......................................................................................58Step2d–DynamicTwoButtonScreen..................................................................................59Step2e–DynamicMultipleButtonScreen..........................................................................60Step2f–DynamicDataEntryScreen....................................................................................61Step2g–DynamicPasswordScreen.....................................................................................62Step2h–DynamicTitleScreen................................................................................................63Step2i–DynamicPopupScreen.............................................................................................64Step2j–DynamicIconGridScreen........................................................................................65

GoogleSpreadsheets.....................................................................................................68PreparingASpreadsheetForLDC..........................................................................................68UnderstandingTheGoogleSpreadsheet..............................................................................69WorkingWithTheGoogleSpreadsheet................................................................................70ImportingAGoogleSpreadsheetFromYourGoogleDrive............................................72UpdatingAnExistingDialogWithAGoogleSpreadsheet..............................................73

TheGUI...............................................................................................................................75LocalizedGUISkins......................................................................................................................75DialogUI...........................................................................................................................................75DesigningNewGUISkins...........................................................................................................76

Page 4: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page4

DialogOnGUI...................................................................................................................78Rendering........................................................................................................................................78GUIRendering................................................................................................................................78GUIScaling......................................................................................................................................79SkinsHD/SkinsSD......................................................................................................................79HDOptions......................................................................................................................................80

SettingUpAWorldSpaceGUI.....................................................................................81HowToSetupABasicWorld-SpaceGUI................................................................................81

DialogWorldSpaceGUI................................................................................................82DisabledInput...............................................................................................................................82MouseInput....................................................................................................................................82TransformInput...........................................................................................................................83Raycasting......................................................................................................................................84Options.............................................................................................................................................85DialogWorldSpaceLineRenderer........................................................................................86WorldSpaceGUIConsiderations.............................................................................................87

Support...............................................................................................................................88

Page 5: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page5

Version History V6.1-UpdatedforUnity2019.3V6.0.1-NextIDsareautomaticallypopulatedwhencreatinganewNextscreen.-Innavigation,wecannowloadscenesandfindotherdialogsusingtokens.-Anewdemoshowinghowtocreateanautomaticsaveandloadsetupinvisualnovels.-Minorimprovementsandbugfixes.V6.0-NewWorld-SpaceGUImodewithsupportforVR.-Newon-screenkeyboardvariationsforDataEntry&PasswordDialogStyles.-PerformanceimprovementsinEditorandatruntime.-Auto-translateroutinesupdatedfornewerunityversions.-Bugfixes.V5.0-LDCisnowcompletelyrewritteninC#.-GoogleSpreadsheetImporternowworkswithinaC#Project.-AllDemoshavealsobeenrewrittentoC#.UPGRADENOTES:-IncludesmodifiedversionofLDCv4.8.3andaDialogScreenconvertertooltohelpusersupgrade.-Logicoperatorsmayresetto“Equals”unlessyoufollowtheupgradeguideandusetheconvertertool.-AllscriptsarenowintheHellTap.LDCnamespace.-JSFunctionArrayCallbackshavebeenremovedfromtheAPIandreplacedwithUnityEvents.v4.8.3-NowcompatiblewithUnity2017.1.v4.8.2-Logicscreensnowhavenewoptions!Afteralogicconditionispassed,youcannavigatetoanotherscreendirectly,usearandomrangeofscreensoruseatokentodynamicallysetthenextscreen!ThismultipliesthepowerofvisualscriptingwithinLDCasyoucannowusetokenstostorescreenID’saswellasrandomizingtheflowofdialogs!-SlidingyourfingeranywhereinthescreencanscrollPopupDialogswithmanualscrolling.-IconGridcannowsetifbuttonsthatPASSlogicconditionsaredisabledorvisible(allowingyoutocreateread-onlylists).-NewAudiooptionsinDialogUI.Youcannowforceaudiotoendattheendofeachscreenandalsofadeaudiooutwhenadialogends.-DialogscannowbeswitchedfromAutomaticallyScrollingtomanualscrollingwhentapped/clicked.OptionfoundinSettings>TextEffects.-NewAPIfunctionstoCreateadialogandoverrideitsstartID-NewAPIfunctionstochangelocalizations.v4.8.1-NowcompatiblewithUnity5.4.4.8-uGUIElementscanbeplacedaboveLDCGUI.-UpdatesToRTVoice3rdPartyActions.v4.7-PopupDialogStylescannowhavecustomsizeforbuttonsaswellascustombuttonspacing.-WhenaddingAudioClips,the“SecondsToShow”optionisautomaticallysetbasedonthelengthoftheclip.-IconGridButtonscannowbeeasilyre-orderedintheinspector.-IconGridTitlesandLabelscannowhavelinebreaks.-Settingtostopspeechaudioifdialogsendearly(DialogUI>UIOptions>StopAudioIfDialogEnds).-DialogStyleswithcustomfontsizesareautomaticallydoubledwhenusingHDskins.-BUGFIX:FixedabugintheIconGridwhichcouldcauseerrorswhenusinglogictohideabutton.-BUGFIX:FixedSendMessageactionbug.YoucannowdirectlysettheGameObjectreferenceforSendMessages.v4.6.2-LDCdialogtextfieldintheinspectorisnowmultiline.-Titletextusingthe‘Title'DialogStylewillnowusethemaintextcolorsetintheinspector.v4.6.1-Unity5.3Compatible(scriptfixesandinspectorsupdatedinUnity5.xtobemorestableandreliable).

Page 6: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page6

v4.6-CompletelynewvisualeditorforDialogUI!NoweverypartofLDChasit’sownvisualeditor!=)-ScreenTransitions!Choosefrom18transitioneffectsandgiveeachscreenitsowninandoutscreentransition!DefaulttransitionscanbesetupintheDialogUI>Settings.-APIUpdatedToSupportScreenTransitions.-SendMessagecannowsendbooleansasarguments.-YoucannowuseDebug.LogactionsinyourLDCscreensatthestartandendofeachscreen.Usethistogetthestatusoftokensoranyothercustommessageyou’dliketoprinttotheconsole!-NewSettingforhowfasttofadethebackgroundUIwhenitisbeinghidden/shown.-NewoptiontoonlyplayanRT-Voiceifnoaudioissetuponthatparticularscreen.ThisallowsyoutousetemporaryTexttospeechtotestdialogswhileyouwaitforvoicestoberecordedfromyourvoiceactors!-DynamicDialogsdemoupdatedtoshowcasedifferenttypesofscreentransitions!-BUGFIX:FixedanissuewhereapplyingtokensusingtheAPIcouldusethewrongdataifyourtokenshadsimilarnames.-BUGFIX:FixedfocusissueswhenchangingtabsintheDialogOnGUIinspector.v4.5

-Thetypewritereffecthasbeenre-writtenwithcadencefeaturesandliveinjectors(seebelow)!-UsecadencetagstoaddtimedDelaysaswellasmodifyingthespeedofthetypewriteratanypointinyourdialogtext.-Typewritereffectscannowbesetonascreenbyscreenbasis!-CreateyourownTextStylestoaddcoolfeatureswithoutalltheusualnastycode!Itworksjustliketokensanddoesn’trequireanyclosingbrackets!Example:"@BoldThisisnowBoldText!"-Settagstosettextcolor,size,boldness,italics,andevenspecialcadencefeaturesliketextdelaysandlivetypewriterspeedchangeswhenusingtypewritereffects!-EasiertousethanUnity’sbuilt-inrichtextwithevenmorefeaturesliketextcoloranimationsandliveopacitybalancing!-Youcannowinjectrichtextintoyourdialogswhileusingthetypewritereffect!-YoucanusetheAPItoinjecttokensandstylesdirectlyintoANYstringinUnitythatsupportsrichtext!ThismeansitwillevenworkwithUnity’snewGUIsystem!=)-Youcannowusescrollingtext!Younolongerhavetoworryaboutyourtextbeingtoolonginconversations!-Youcansetthescrollabletexttobeeitherautomaticallyscrollingormanuallyscrollingwithaverticalscrollbar.-SetupscrollingspeedandscrollablefooterspacinginDialogUI>Options!-Scrollabletextcanbesetuponascreenbyscreenbasis!-Use@Scrolltagstochangethescrollingspeedwithinthedialogtextitself!-AutoScrollingnowworksonsubtitletextsoyoucanmakereallycoolthingslikecreditsandscrollingstorysections!-OverridethedefaultfontandsizeofyourTitlescreensonaper-screenbasis!-Newcontrolsoverthetextareasizeofboththetitleandsubtitle.-Textalignmentcannowbesetindependentlyoneachtitleandsubtitle.-Allofthesesettingsareoverridessoyoushouldn'thavetomodifytheexistingGUISkins!=)-AddedButtonAlignmentinIconGridView(thisissowecancreatelistswithleftorientationwithouthavingtochangetheGUISkin!)-OptionsforhidingtitleandbodytextnowapplytotheIconGridstyles.-SetupvoicesforRT-VoiceinDialogUIandeasilyplaythemintheactionstabinLDC!It’ssupereasytousetext-to-speechinyourprojectswithLDC!PleasenoteRT-VoiceonlysupportsMacandWindowsstandalonebuilds.-NewsectionaddedtoDialogUIforsettingupthirdpartyplugins.Youcansetup-API_DialogCreate()functioncannowtakeanextrastringargumenttoallowforcustomGameObjectnames.-APIforallrelevantscreensupdatedtousetypewriterandscrollingoverrides,aswellasallthenewfeaturesforTitlescreens!-TheDynamicDialogsdemohasalsobeenupdatedsoit’seasytolearnhowtheAPIworks!-Fixedanissuethatcouldcausecustombuttonlabelstonotappearcorrectly!-NewOptionstocontrolthefeedbackfromLDCviatheconsole!-Optionstotogglesystem,actionandlogicconsolemessagesindependently.-Helpstodebugyoursetupwhenyouneedit,andswitchitoffwhenyouwantanunclutteredconsole!-Codeenhancementstovariousstyles.-NewroutinesshouldmakeitpossibletoaddshadowstoyourtitleandbodytextregardlessifyouhavecustombackgroundsinyourGUIStyles.-AddedsomelabelsinDialogUItobetterorganisethedialogoptions.AfullDialogUIcustominspectorisplannedforafutureupdatesoon!-FixedanissuewhereaddingconditionstoIconGridswouldcausetheUItobecometoowide.v4.4-AutomaticTranslationsforChinese,KoreanandJapanese(notethatKoreanandJapanesetranslationsarestillinbeta).-NewvisualDialogLocalizationEditorwithnewoptions!-LanguagescannowbedetectedusingtheoldsystemorusingacustomPlayerPrefsstring.-LanguagesettingscannowbeeasilychangedatruntimewithvisualactionsintheinspectorandviatheAPI.GUISkinscanalsobeautomaticallyreloaded!-Fixedissuewhenswitchingscenestooearly,whichcouldcausenewdialogstonotshowproperly.v4.3-Unity5ready!-SeamlessDialogThreadNavigation-youcannowseamlesslychangetoanyscreenofanydialogwithouthavingtowaitforLDCtofadeinandout!ThiscanbedoneusingeitheranLDCprefaborfindinganotherLDCDialoginthescenebyname.Youcanevenchoosetheexactscreeninsidethenewdialogthreadtonavigateto!-LDCcannowsendTokensasthestringargumentofNavigationCallbacks.

Page 7: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page7

-OptiontofinishtheTypewritereffectearlywhentouchingthescreenorclickingmouse(DialogUI>Options>CompleteTypewriterEffectOnClickOrTouch).-Setthefadeintimeofthebackgrounddialoggraphics(DialogUI>Options>BackgroundFadeDuration).-PerformanceImprovementintheEditorforlargedialogthreads(LDCAlsohelpsyoutosplitupyourdialogscreenswhentheyaregettingtoolarge)!-Fixed2Buttonnavigationcallbacksalwaysreturning0asabuttonID.-Typewritereffectalgorithmimprovedtobemoreconsistentacrossalldevices.v4.2-NEWIconGridDialogStyle!Createacustomgridoficons(greatformerchantscreens,levelselects,optionsandmore!)-OptimizedthePopupDialogsdialogstyletorunmoreefficiently.-SetwhichlayerLDCisbeingdrawntowithGUIDepthoptionsinDialogOnGUI>Options.-LDCcustomiconshouldshowcorrectlyinUnity4.xinspectorwindows-DroppinganAudioClipintotheDialogstabcanautomaticallygenerateaudiofilepathsforaudiostreaming!-PopupDialogIconchanged.-GoogleSpreadsheetFeaturesmovedto"ThirdPartyExtras”folderasanoptionalinstallation.v4.1-NewDialogOnGUIEditorwithGUIScalingfeatures.-Use‘StretchToFill’,‘ScaleToFit’,and‘OverScale’modestorendertheLDCGUI.-Minorfixes,includingswitchingbetweentabswhilefocusingonpreviouselements.NOTE:DuetothefactthatLDC’scopyrightnowbelongstoHellTapEntertainmentLTD,therehasbeensomerebrandingandrenamingoffolders.IfyouareupdatingLDC,keepaneyeoutonthisasUnityoftendoesn’tcorrectthingslikethat.Youmayneedtorenameanyfolderlabeled“BlackZombie”to“HellTapEntertainment”.Makesuretobackupfirst!v4.0-EasilyimportandupdateLDCDialogsusingonlineGoogleSpreadsheets.-NEWPopupDialogStyle–Createcustompopupmessageswithanimatedbackgroundsandbuttons.-LDCGUIAbstraction–GUIpartofcodeseparatedtoallowforcustomUIimplementationsinthefuture.-NavigationFunctioncallbacks–SendMessagewhenauserpressesabutton.Demosceneincluded!-APIupdatedtoallownavigationcallbackstobecreatedwithdynamicdialogs.(DynamicDialogsDemoupdated.TIP:Addanextranullargumenttogetolderscriptstowork)-SetupautomaticGUISkinswitchingbetweendifferentplatformsandbuilds.-FocusGUIwithInputAxesaswellasKeycodes.-PlayAudioonbuttonrolloverandclick.-InspectorPerformancevastlyimproved.IMPORTANT:ExtraconditionsonMultipleButtonshadtobere-writtentoworkcorrectlywithUnity4.5+.UpdatingtoLDC4.0willdeleteanyextraconditionsyouhavecreatedinyourpreviousMultipleButtonscreens.v3.9-Create“DataEntry”DialogScreensdynamicallyviatheAPI.TheDynamicDialogsdemohasbeenupdatedtoshowcasethenewfeaturesofLDC3.9.-APInowsupportscallbacksviaSystem.ActionwhichshouldworkasequalcitizensinC#,JSandBoo(NOTE:ToupgradeolderAPIscripts,justaddanother2nullargumentsineveryAPI“DialogAdd”functioncall).-APIhasanewfunctiontoreturntheindexofaTokenbyname.API_GetTokenIndex(nameOfToken:String).-FIX:MultipleButtonscreenscreatedpriortoversion3.8areautomaticallyfixedbytheeditortoworkwiththenewversion.(HOWTO:SelectadialogthathasaMultipleScreenintheeditor.Ifyouseea“FIX”messageintheconsolethiswillindicatethattheeditorhasfixedanyproblems.Ifyouareusingadialogsavedasaprefab,makesureyouclick“Apply”tosavethechanges).v3.8-Addgraphicsandanimationstobuttons!-New“DialogButtons”sectionaddedtotheDialogLibrary.-YoucannowloopanAudioClipduringthetypewritereffect.AddacliptoDialogUI>Options>PlayTypewriterAudio.-Tokenscannowbeapplieddirectlyintobuttons.-“SortAllDialogs”nowworksonanydialogthread.-LDCmenushortcutsarenoworganizedintheGameObject>LDCsubmenu.v3.7-Load/RestartUnityScenesfromNavigatetab.-TheNavigatetabcannowLinkdifferentDialogstogetherbyusingprefabsorplayingexistingdialogsinthescene.-PlayMakerActions!Separatepackageavailable(in‘TheLDCDemos&Extras/ThirdPartyExtras/PlayMaker).v3.6-Logicin“LogicScreens”and“MultipleButtons”nowsupportmultipleconditions(equivalentof&&operator)-DialogCast/ScenesInspectorsupdatedtofixminordisplayissuesonUnity4.xv3.5.1-Performancefortypewritereffectimproved(especiallyformobile)-Auto-detectlanguagedetectionimproved.-PortraitscannowberepositionedusingGUISkins(Use‘ContentOffset’inthe‘ActorPortraits’customstyle).-ButtonscannowberepositionedusingGUISkins(Use‘ContentOffset’inthenew‘ButtonOffset”customstyle).

Page 8: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page8

v3.5-LogicConditionscansupportkeysfromUnity’sPlayerPrefsaswellasLDCTokens!-MultipleButtonConditionssupportlogicfromPlayerPrefsaswellasTokens!=)-Create,EditandDeletePlayerPrefsrightinsideofLDC,onaperscreenbasis!-LDCShowsyouacountofhowmanyactionsyouareusingacrosseachtab,makingiteasiertokeeptrackofthings!-APIupdatedtodynamicallycreateTitleScreens.-APISupportsfunctioncallbacks“AtStart”and“AtEnd”ofeverydynamicscreen.-APInowsupportshidingthebackgroundUIoneachdynamicallycreatedDialogScreen.-UpdatedAPI–DynamicDialogsDemotoshowcaseallthenewfeatures!-Bugfix–UsingInputkeyswouldsometimestriggeractionstwice.v3.4-AutomaticTranslations!YoucannowautomaticallytranslateyourDialogsintoSpanish,Italian,German,French,PortugueseandRussianwithasingleclick!Youcantranslateasinglelanguageperscreen,alllanguagesperscreen,orALLlanguagesperDialogThread!NOTE:thisfeaturewillbeavailableinLDCaslongasYandexprovidestheservicewithoutcharge.-Fixedbugwithchangingsubtitlecolorin“Title”Dialogs.-Fixedbugthatcausedlocalizationstobelostwhile“Sorting”dialogsfromtheDialogController.-UpdateddefaultRussianSkintosupportRussianHeaderText.

v3.3-UIisnowfocusenabledandfullysupportstheKeyboardandmostjoysticksviaeasytouseKeyCodes.-NewvariablesinDialogUItosetupKeyCodes(“selectGuiWithTheseKeycodes”,“focusNextGuiWithTheseKeycodes”,and“focusPreviousGuiWithTheseKeycodes”).-New“Title”DialogStyle.Nowyoucaneasilycreatetitles,intros,chaptersandmore!-NewDialogoptioninnavigationmenutohidethebackgroundUIstrip.Allowsforcontrolonaperdialogbasis.-AddedgizmoiconstotheLDCscripts.v3.2-The“MultipleButtons”DialogStylenowsupportsoptional“Conditions”(eachbuttontestedagainstTokenvalues).-IntroducedHD(1920x1280)Skins.-Choosebetweenlegacy/HDskinswith“Skins>UseHiDefSkins”inDialogUI.

v3.1-ActorPortraitsarenowcustomizablefromtheDialogSkin(useFixedWidth/HeightandContentOffsets!).Youcannowrepositionandresizethem.v3.0-Portraits,ActorandBackgroundLayerscannowbeanimations.Liveupdatingofanimationsintheinspectors.-AnimationsarenowsetupintheDialogLibrary(inDialogCastandDialogScenes).-NotesfeatureaddedonallDialogScreens.Easilykeeptrackoflongdialogsineverytab. v2.9.1-Flashbuildsfixed.v2.9-NewfeaturesandUIforGameObjectActions(SendMessageandde-activatebeingthemostnotable!).-NewDialogUIoptiontoskipNext/OneButtonDialogsusingInputkeys.-[Fix]ScreendurationnowalsoappliestoOneButtonDialogs(aswellas"Next"Dialogs).v2.8.1.1-FixedRussianandPortugueselocalizationoptions.-FixedPasswordScreen’s“Mask”option.v2.8.0-AddedAutomaticFileManagement!Youcaneasilysave,loadanddeleteyourtokensintomultiplesaveslots!-NewFileManagementActionsintheTokenstab!-NewFileManagementAPIgivingyoufullcontrol!v2.7.0-FullFlashsupport!LDCshouldnowbefullycompatiblewithFlashbuilds,astestedwithUnity4.1.2.

v2.6.0-AddednewadvancedfunctionstotheAPI.YoucannowdynamicallycreateentireDialogthreadscompletelyviascripting.Tokens,ActionsandlocalizationsarenotavailableviatheAPI(althoughtheycanbeimplementedinscriptanyway!).-LimitedSupportforFlashbuilds.MostthingsshouldworkexceptforToken-basedactionsandrelatedDialogstyles(egDataEntry/Passwordscreens).v2.5.0-Addedthe“Logic”DialogStyle.Thisallowsforanincrediblypowerfulwayofusingvisualscriptingtomakeontheflynavigationdecisions.Usingthebuilt-intokensystem,youcancomparetokensontheflyusinglocalizedvaluesandallowthesystemtomovetodifferentscreens!

Page 9: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page9

-Added“GlobalTokens”.Togglingthiswillkeepyourtokensintactbetweenscenes.NOTE:MakesureyouhavethesameDialogUIprefabineachscene!-AddediconstotheDataEntry,Password,andLogicDialogstyles.-Thedynamicformattingofnumerictokensisvastlyimproved.v2.2.0-Addedthe“Password”DialogStyle.Comparedataentrytoalocalizedstringoratokenwith2waynavigation.

v2.1.0-3rdPartyScriptingAPI.LDCcannowtalktoandreceivefunctionseasilyfromothertoolsandscripts.-uSequencerIntegrationbuilt-in.SetupandcontrolyoursequencesdirectlyfromyourDialogScreens!-New3rdPartyActionstabaddedtosupportotherpluginsandtoolsinthefuture!-LocalizationcomponentrenamedtoDialogLocalizationtoworkbetterwithotherplugins.v2.0.0-“DataEntry”DialogStyleforcollectinguserdataandstoringthemintoTokens.-Tokens–Variablelikeobjectsthatcanstoredata.TokenAPIavailabletoset/gettokensviascript.-Background&ActorLayers–Easilycreatefullscreencomic/visualnovelstylecutsceneswithease!-DialogLibrary–CentralizeyourimagesforthepluginandselectthemeasilyinDialogScreens!-NewActionsforBackground&ActorLayers,CustomAudioChannelsandTokens.-TypewriterTexteffectandmoreDialogUIoptions.-VariousEditorTweaksandShortcuts.v1.5.0-“MultipleButton”DialogStyleforverticallyorientedmultiple-choicescreens!-MoreDialogUIoptionstoindependentlyhidedifferenttextelements.-DialogUIoptiontoignorescreendurations,andforceuserstoclick“Next”orcustomsinglebuttonstoprogress.-SelectinganactorfromthecastalsoreplacestheactornamefieldintheDialogScreen,savingevenmoretime.-AddinganewDialogScreenfromtheDialogControllernowcopiesoverthepreviousportraitandactorname.-VariousUIbugfixesandvalidationcode.-0.75secondsisnowthedefaulttransitionspeed(25%fasterthanpreviousversions).ThiscanbesetbackinDialogUI.v1.2.0-“DialogCast”Featureandsmallupdatestosupportingeditors.v1.1.1-UpdatedDocumentation.

v1.1.0-StandardDialogvariationsimplementedintothenew“DialogStyles”system.-CustomSingleandTwoButtonDialogStyles.-NewPer-Screentransitionandvisibilityoptions.-Newglobaloptionstocontrolallmotion,fades,shadowsandmoreoftheDialogUI.-MemoryimprovementsintheOnGUIroutine.v1.0-FirstCommercialversionofplugin.

Page 10: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page10

Installation and Setup Guide

1) Installthepackagefileintoyourproject.2) Createanewgametagcalled“DialogController”

NOTE:Don’tforgettocreatetheDialogControllertag!

3) Next,weneedtocreatetheDialogUIobjectineverysceneofourproject.ThishandlesalloftheUI,LocalizationandAudiofunctionsofthesystem.CreatetheDialogUIobjectbyclickingon“GameObject>CreateDialogUI”intheUnitymenu.The“DialogUI”objectwillappearinyourscenealreadysetupforyou.Typically,thisshouldbesavedasaprefabsothatitisthesameobjectineveryscene!Then,youshouldcreateagloballibraryofyourgame’sActors,Portraits,Scenes,Animations,etc.youcandothisbyclickingonGameObject>CreateDialogLibrary”.ThisGameObjectshouldbemadeintoaprefabthatyoucanuseoneveryscene.

4) Now,wecanchoosewhichlanguageswewillsupportinourgame.Inthefirstsceneoftheproject(eg,thegamesplashscreen),clickonthe“DialogUI”GameObjectandopenthe“SupportedLanguages”sectionoftheDialogLocalizationcomponentintheinspector.(NOTE:anylanguagethatisnotcheckedwilldefaulttoEnglishasafallback).

Page 11: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page11

Legacy LDC Upgrade Guide NOTE:Fornewusersandprojectsthischaptershouldbeskipped(gotopage12).

ForthoseofyouwhoaretryingtoupgradefromLDCv4.8.3(Unityscript)toanewerLDCversion(writteninC#),thesearethestepsyoushouldfollowforminimalissues.Pleasenotethatupgradingasystemtoacompletelydifferentlanguagecanbetricky,soI’drecommenddoingitonlyifyoureallyneedto.

Setup ThefirstthingtodoisBACKUPYOURPROJECT.Seriously,thisistrickystuffandsomethingmaygowrong.

1) ThebestwaytoavoidconflictsistototallydeletetheolderLDCfilesandfolders.Deleteallfoldersinthefollowingdefaultlocations(ifyouhavemovedthemyouneedtotrackthemdownandremovemanually):

EditorDefaultResources/Editor/HellTapEntertainment/LocalizedDialogs <-FolderEditorDefaultResources/Editor/HellTapEntertainment/Shared/Scripts/HTE_EditorLibrary <-File

Plugins/HellTapEntertainment/LocalizedDialogs <-FolderTheLDCDemos&Extras <-FolderNOTE:DonotdeleteyourLDCGameObjectsfromyourgame.Onlythecorescriptsneedtoberemovedsowecanupgradeproperly.

2) Youmayseecompileerrorswhileyoudothis-don'tworryatthisstage.ThenextstepistoinstallthelatestLDCpackagesoitistheonlyversioninyourproject.

3) DownloadandunziptheLegacyLDCUpdaterarchivefoundhere:http://www.unitygamesdevelopment.co.uk/Public/Promo/Localized%20Dialog%20Plugin/LegacyLDCUpdater

4) MovetheLegacyLDCfolderfromthezipyoudownloadedintoyourUnityprojecthere:"TheLDCDemos&Extras/Extras/

5) InsideUnity,findthefolder'LDCv483scripts'packagefoundin"TheLDCDemos&Extras/Extras/LegacyLDC/"folder(whereyoujustmovedit).ThisisamodifiedversionofLDCv4.8.3,whichhasitsownspecificfoldersandmenuitemstomakeiteasiertotellthemapart

6) Youcantheninstallthe'LDCJStocSharp'converterpackageinthesamefolder.Bythispoint,allthecompileerrorsshouldhopefullybegoneandyou'llhavebothLDCandamodifiedversionofthelegacyLDC4.8.3workingsidebyside.

NOTE:IfyouhadanycustomscriptsusingLDCthatarenowcausingerrors,youcantryadding"usingHellTap.LDC"tothetopofyourscriptstomakethemaccessibleagain.ThiswillmakeyourscriptsusetheC#versionofLDC.

Page 12: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page12

Upgrading Your Scripts

Ifyouhaveworkedthroughthepreviousphaseandhavenoconsoleerrors,itwouldbeagoodtimetomakeabackupofyourproject.

1) ThenextstepistorebuildyourDialogUIandDialogLibraryprefabwiththeC#versionsofthescripts.AquickwaytodothisistosimplyoverridethescriptintheinspectorbyswitchingUnityto"Debugmode"(nexttothelittlepadlockiconinthetoprightoftheUI),anddraggingtheC#versionofthescriptintothe"Script"slotintheinspector.NOTE:TheC#versionoftheLDCscriptscanbefoundhere:Plugins/HellTapEntertainment/LDC/Scripts/ThisprocessshouldworkfinefortheDialogCast,DialogScenes,DialogButtons,DialogUI,DialogOnGUIandDialogLocalizationcomponents.Iftheyareprefabs,don'tforgettopressthe"Apply"buttonintheinspectortosavethechanges.

2) YounowneedtoupgradeyourDialogScreenobjects.Luckily,the"LDCJStocSharp"convertertoolscriptyouinstalledwillmakethisabreeze!ClickonanexistingLDCGameObjectandfromthemenu,select:GameObject>LDC(JS)>ConvertLDCDialogToC#Thiswillconvertallofyourdialogscreens(aswellastheDialogController)intotheC#versionandifeverythinggoeswell,yoursettingswillbepreserved.Keepaneyeontheconsoleasifanythinggoeswrongawarningmessagewillappearandyoushouldbeabletoundothechange.IftheGameObjectwasaprefab,don'tforgettopressthe"Apply"buttontosavethechangestotheGameObject.YouneedtodothisforeverydialogGameObjectinyourgame.It'sagoodideatomakeregularbackupsduringthisprocess.

Cleaning Up

Onceyourentiregameisconverted,youcansafelygetridofthelegacyscripts.Thesearethefoldersyoucannowremove:

EditorDefaultResources/Editor/HellTapEntertainment/LocalizedDialogsv483 EditorDefaultResources/Editor/HellTapEntertainment/LDCJStocSharp Plugins/HellTapEntertainment/LocalizedDialogsv483

That'sit,youshouldnowbeupandrunningwithLDC5.0!

Page 13: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page13

About Dialogs

DialogsarebuiltupofoneDialogControllercomponent,andatleastoneDialogScreencomponent.Whenadialogisinuse,itsendsdatatothe“DialogUI”classwheretheGUIsideofthingsaretakencareof.Luckily,wehavesomeprettycooleditorstoworkwith!

Youcancreateanewdialogobject(alsoknownasa‘DialogThread’)byclickingon“GameObject>LDC>CreateNewDialog”intheUnitymenu.

About Dialog Controllers The“DialogController”controlstheinnerworkingsandflowofeachdialogthread.Also,wecandefinewhetheraparticularDialogwillauto-playwhenitisloadedinthescene(greatforone-shotloadingofprefabs!)orwhetheritwillremainidleuntilitistoldtoplayviaascript(usefulforRPGtypegamesforexamplewherecharacterscanre-usethesamedialogs).Also,thereisa“SortDialog”buttonwhichallowsforthere-orderingofyourDialogScreensalongwithahandy“+”buttontoquicklyaddanewDialogScreentothethread.

About Dialog Screens The“DialogScreen”iswherealltheimportantstuffgoes!Itisdividedinto4tabs:

“Dialogs” forsettingupthedialogtext,actorname,iconimage,audioplayback,etc.Basically,thisistheactualcontentofthedialog.

“Navigation”forsettinguptheflowofthedialogthread.Forexample,willthisbeaYes/Noquestionthatcantakeyoutodifferentscreensorwillthisbeasimpledialogthatmovesontothenextscreen,etc.

“Actions” toeasilyinstantiate,activate,ordestroyGameObjectsatthestartorendofascreen.AlsoprovidesaccesstospecialactionstocontrolBackgroundandActorlayers,customaudiochannels,LDCTokensandmore!

“Localize” toeasilylocalizeeachdialogscreenindifferentlanguages.

DialogController DialogScreenDialogUI

Page 14: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page14

About Dialog Localization

Introduction LDCisheavilyintegratedwithinaneasytouselocalizedenvironment.TheDialogLocalizationcomponent(foundattachedtotheDialogUIGameObject)iswhathandleslanguagedetectionandsetupwithinLDC(itcanalsobeeasilyusedwithinyourownscriptstoo–checkthecommonscriptssectionforexamples!).

ThefirstparttheDialogLocalizationcomponenthandlesislanguagedetection.Dependingonwhichlanguageisdetected,theappropriatelocalizedtextwillshowwithinyourdialogs.

Language Detection Modes LDCofferstwodifferentwaystodetectLanguages:DetectSystemLanguageMode

Thefirstmethodisthe“DetectSystemLanguage”mode.ThisapproachusestheruntimeoperatingsystemtotellLDCwhichlanguageisbeingusedandwillautomaticallyshowthecorrectlanguage-assumingyouhavealloweditwithintheSupportedLanguageslist(seetheSupportedLanguagessectioninthischapterformoredetails).

Thismodeisgreatforsimplegameswhereyouareeitheronlyusingonelanguage,orifyouwantthistobeautomaticallyhandledandhiddenfromtheuser.LDChandlesitallautomaticallywithoutyouhavingtodoanything!

UsingPlayerPrefsKeyMode

ThesecondmethodallowsyoutouseacustomPlayerPrefskeytotellLDCwhichlanguagetouse.ThisallowsyoutogivetheplayerthechoiceofwhichlanguagetouseanditisevenpossibletosetthelanguagewithintheDialogScreenoptionsatanypointduringruntime.Englishisalwaysusedbydefault.

Page 15: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page15

Thismodeisgreatformoreadvancedsetups,orifyougenerallywanttogivethechoicetoPlayerstopicktheirlanguage.AnotherexampleisthisPlayerPrefskeywillbeavailableinLogicScreens,whichwillallowyoutomakeconditionallogicbasedonwhatlanguageisbeingused.

Supported Languages IntheSupportedLanguagestab,youwillbeabletochoosewhichadditionallanguagesyouwanttosupportinyourgame.

Simplychecktheboxnexttoeachlanguageifyouwanttoallowyourgametoshowcontentinthatlanguage.

NOTE:MakesureyousetthisupcorrectlybecauseifalanguageisnotselectedinthislistbutisdetectedbyLDC,itwilluseEnglishasafallback.Thisisbecausethesystemwillassumeyoudonotwanttosupportthatlanguage.

Page 16: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page16

Setting Up A Dialog Screen – Dialogs Tab

Introduction TheDialogstabisthefirstsectionofanyLDCDialog.Itoffersaneasywaytochoosewhatstyleofdialogwillbedisplayed,aswellassetupthevariouspropertiesanddatathedialogwillconsistof.Thesepropertiesarenotalwaysthesame.Theyaredependentontheselected“DialogStyle”.

Dialog Styles DialogStylesdeterminethe“template”oftheUIthatispresentedtotheuser.InthecurrentreleaseofLDC,thefollowingDialogStylesareavailable:NextButtonThe“NextButton”styleshowstheuserasimpledialogscreenwithaportrait,onelineofheadertext,somedialogtext,andanautomaticallylocalized‘Next’button.ThismeansthetranslationsforthebuttonwillbeimplementedautomaticallyinallofLDC’ssupportedlanguages(evenSimplifiedChinese,KoreanandJapanese).TheNextbutton,aswellasmostdialogstylesalsoallowsyoutostreamaudiofromyourUnityResourcesfolder,whichmakesitextremelymemoryefficient-especiallyonmobilebuilds(youalsohaveoptionstoplayanAudioClipdirectlyusingtheActionstab).YesOrNoSimilartothe“NextButton”stylebutoffersautomaticallylocalized“Yes”and“No”buttonstonavigatewith.OneButtonThe“OneButton”styleisacustomversionofthe“NextButton”.Notonlycanyourenamethebuttonlabelbutyoucanalsoapplyacustomimageofanimationtobeusedasabuttonicon.

Page 17: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page17

TwoButtonsSimilartothe“OneButton”stylebutofferstwocustombuttons.MultipleButtonsThe“MultipleButtons”styleisaverypowerfulscreenandoffersaverticallistofbuttonsthatareincrediblyflexible.Itcanbeusedformultiple-choiceanswers,asanin-gamemenu,orevenasimpleinventoryormerchantscreen.TheMultipleButtonsstylealsoallowsyoutoadd‘Conditions’tomakebuttonsappearonlyifasetofeventsaretrue.Forexample,youcanshowabuttoncalled“CompleteQuest”onlyiftheLDCTokennamed“QuestCompleted”equals“1”.See“Logicscreen”(thenextchapter)formoreinfoabouthowthe‘VisualLogic’systemworks.DataEntry

“DataEntry”screensaredesignedtopulldatafromauseraseasilystoreitintoanLDCToken.Thevalueofthesetokenscanthenbere-usedinlaterdialogsoreveninVisualLogic(e.g.grabbingtheplayer’snameandthenusingitindialogs).

TheDataEntrystyleoffersyoutheabilitytodefineitpositiononscreenusinganchors(top,middle,bottom),whichTokentosavethedatainto,whatformatitis(TextorNumber),acharacterlimit,andadefaultvaluefortheinputfield.Youcanofcourserenamethebuttonandaddacustomicon.

Password

Totheuser,the“Password”screenlooksverysimilartotheDataEntryscreen.However,underthehoodthereisalargedifference.ThePasswordstyleisdesignedtotaketheuser’sinputandcompareittoeitheranLDCtokenorapre-definedstringoftext.

ThestyleoffersyoutheabilitytopositiontheGUIwiththesameanchorsastheDataEntrystyle,makethecomparisoncase-sensitive,aswellusingapasswordmask(using***inplaceoftherealtext).Italsoinheritsmanyofthestandardfeaturessuchascustombuttonlabels,iconsandaudiooptions.

Logic

TheLogicstyleistheonlydialogstylethatdoesnotreflectintheGUI.SeethenextchaptertolearnallabouttheVisualLogicsysteminLDC!

Title

The“Title”dialogstyleallowsyoutocreateinterestingTitlesequences.DependingonhowyouhavesetuptheGUISkin,youcancreatefullscreentextsnippets(greatforvisualnovels),credits,gametitlesandmore.

Youcansettextforyourtitleandsubtitle,positionthemwithpixelaccuracyusingXandYvalues,aswellassettingtheirgenericcolours.Asinglebuttonisalsoavailablefornavigation,asitthedefaultaudiooptions.

Page 18: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page18

Popup

The“Popup”dialogstyleisnewtoLDCv4.0andallowsyoutocreateverydiversepopupmessages/windows.Youcanchangethesizeofthepopup,addcustomanimatedbackgroundsandbuttons,aswellastheoptionofhavingoneortwobuttons.Thisisgreatforaskingtheusertoverifyachoice,atutorialscreen,orevenanin-apppurchasescreen.

IconGrid

The“IconGrid”dialogstyleisapowerfulnewdialogstyleinLDCv4.2.Youcansetupawindowwithascrollviewtodisplayacustomlayoutoficons.Thisscreeniswellsuitedformerchantscreens,inventories,LevelSelects,andmuchmore!

Dialog Properties

HereisreferencelistofthepropertiesyouwillfindintheDialogstab,alongwithabriefexplanation.

DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.YoushouldmakesurethateachDialogScreenhasadifferentIDonthisGameObject.

DialogNote: (YellowField)Keeptrackoflongdialogthreadsbyaddinganote.Thecheckboxnexttothisfieldenables“Auto-Notes”.Thisfeaturecreatesadynamicnotebasedonthetitleandtextofeachdialogscreen.Veryusefulforkeepingtrackofwhichdialogyouareworkingonindifferenttabs!

DialogStyle:SelectstheDialogStyleofthecurrentdialogscreen.

Portrait: Theportraitallowsyoutosetupanactororanicontobedisplayedwithmanytypesofdialogstyles.IfyouhavesetuptheDialogCast(seetheDialogLibrarysectionformoreinfo),youwillbeabletoselectanimationsaswellasimagesusingthe“ViewCast”button.

ViewCast: Opensthelibrarytoselectanactortobeusedasaportrait!

NoPortrait: Removesanyselectedimageoranimationfromanimageslot.

NoAnim: Removestheanimationfromanimageslot,butattemptstocaptureitsfirstframeasastaticimage.

Title/Name: AtitleorthenameofanActorshouldbetypedhereinEnglish(thedefaultlocalization).Youmayalsoleavethisblank.

DialogText: Thisisusedtowritetheactualtextyouwouldliketodisplaytotheuser.Inthisfield,youshouldusethedefault“English”localization.

Page 19: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page19

CustomButtonLabels: ThesewillappearifyouareusinganyDialogStylethatrequiresoneormoreCustomButtons.Hereyoushouldrenameyourbuttons(inEnglish).Youmayalsochoosetolocalizetheminthe“Localize”tab.

CustomButtonIcons: Hereyoucanaddanimageoranimationtoabutton(NOTE:YouneedtosetuptheDialogButtonsLibrarytoapplyanimations).

DropAudioClipToStream: YoucandropanAudioClipthatislocatedinyourResourcesfoldertoautomaticallycreateanAudioFilepath(seebelow).LDCwillalsosetthedialogdurationtothelengthoftheclipforyou.IftheAudioClipisinthewrongfolder,LDCwillshowyouamessageexplainingwhattodo!

AudioFilepath: Thisistheaudiopathfromthe“Resources”folderofyourproject.Thishelpsmanagememoryusagebyonlyloadingintheaudioclipsyouneedatruntime.

eg,ifyouhadanaudiofilelocatedat“Resources/Audio/NowYouSeeMe”,youwouldsimplytype“NowYouSeeMe”inthefieldasthereisanaudioprefixalreadyaddedintheDialogUIcomponent.

NOTE:BydefaulttheaudioprefixintheDialogUIcomponentissetto“Audio/”Youmaychangethisintheinspectorbutit’srecommendedtokeeptothisfilestructure.Also,it’sagoodideatomakesureyouraudioisn’tsetupasa3DsoundinUnity’simportsettings!

UseTypewriterEffect: Choosewhetheryouwantyourtexttobetypedletterbyletterortobeshownallatonce.

TextScrollingOptions: Choosewhetheryoudon’twantscrolling(off),Automaticscrollingormanualscrollingwherethereisaverticalscrollbarfortheusertomanuallyscrollthroughthetext.

AudioPitch: Changethepitchofaudiowhenitisbeingplayed.1.0isthedefault,lessisadeeperpitch,andgreaterisahigherpitch.

DataEntry: Inthisscreen,youcanuse“Position”toanchortheGUItothebottom/middle/topofthescreen.“TokentoSet”allowsyoutochooseatokentosavethedatainto,“DataFormat”isusedtosetupthedataasanumberortext,andfinallyyoucanalsosetacharacterlimittocontrolthelengthofthedata.

Title: Inthisscreen,youcansetupthenameofthetitleandsubtitleyouwanttodisplaybyaddingtextintothe“Title”and“Subtitle”fields.Youcanchooseexactlywheretoplacethetextusingthe“PositionX”and“PositionY”fields,andsetthecolorofthetextwiththerelative“Color”fields.

Popup: Inthisscreen,youcansetupthenameofthetitleanddialogtextintheexactlythesamewayasthetraditionaldialogstyles.ThePopupstyledifferentiatesitselffromtheotherbyallowingyoutosetupacustomsizeforthewindowandbuttonsbyusingtherelevant“size”fieldsaswellaschoosingastatic/animatedbackground.Theopacityofthebackgroundcanbemodifiedusingthe“BackgroundAlpha”field.Finally,youcanselecteitheroneortwobuttonstobevisibleoneachPopupscreenusingthe“Options”dropdownmenu.

TITLE/POPUPTIP:Title’sandPopupstendtolookalotcoolerwhenyoudisablethebackgroundUI(bydefaultthisisthesmallblackstripatthebottomoftheinterface).Youcaneasilydothisbyclicking“HideUIBackground”intheNavigatetab!

Page 20: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page20

Setting Up A Dialog Screen – The “Title” Dialog Style

Thetitlescreenistheperfectscreentouseifyouwanttobuildcredits,introductionsorstorysegments.Itallowsyoutoindependentlysetupboththetitleandthesubtitleandplaceitexactlywhereyouwantitonthescreen.Usethe“PositionX/Y”fieldstoplacethetextonthescreenatthosepixels.The“AreaSizeX/Y”fieldsallowyoutosethowyouwanttocropyourtext.

Youcanhavethesystemuseaspecificfontbyusingthe“OverrideSubtitle/TitleFont”fieldswhichisgreatbecauseitmeansyoudon’thavetomodifyyourGUISkins!Thetext’sdefaultsizecanbechangedbyusingthe“Subtitle/TitleFontSize”fields.Textalignmentisalsocustomizablebyusing“Sub/TitleTextAlignment”.

ThedefaultcolorscanalsobechangedusingtheColorpalletes.

TITLETIP:Thecombinationofscrollingoptionsandtypewritereffectscancreatesomeveryinterestingsequencesforyourprojects!

Page 21: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page21

Setting Up A Dialog Screen – The “Icon Grid” Dialog Style

IconGridshavetheusualTitleandSubtitlefieldsbutthensplitsitssetupbetweenWindowOptionsandIconLayout.

Inthe“WindowOptions”tab,youareabletosetupvarioussettingsconcerningthelayoutandappearanceofthewindow.Otherthanchangingthesizeofthewindow,youcanoffsetitspositionusingthe“WindowOffsetX/Y”values.Theoffsetisappliedafteritiscenteredonscreensoyoucanhavecontroloverplacementifpreferred.AstheIconGridstylealsocontainsanautomaticallygeneratedscrollablecontentlayer(calleda“ScrollView”),youcanalsosetthescrollbarstobeturnedon/offusingthe“AlwaysShowX/YScrollbaroption”.Notethatifyouriconstakeupmorespacethanthecontentarea,thescrollbarwillalwaysbevisible.Youalsohavethechoicetohidethetitleandsubtitleareasofthewindow(“ShowTitle/SubtitleText”)aswellasaddspacebetweenthetitleareaandthecontentarea(“AddSpaceBelowTitles”).Youalsohavecontroloverthebackgroundsoyoucanhidetheentirewindowpanel,applyacustomimageoranimationasthebackgroundandsetitsopacity.

The“IconLayout”taballowsyoutosetupthelayoutoftheiconsandlabels.Themostobvioussettingsarethe“IconSizeX/Y”valuestocontrolthesizeofthebuttons.The“IconsPerRow”valueisveryimportantforsettingthelayoutofyourIconGrid.Thissettingreferstohowmanybuttonsitshouldshowineach

Page 22: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page22

horizontallinebeforedrawingthenextrow.The“LayoutSpacing”fieldallowsyoutoaddspacearoundtheiconstomakethemclosertogetherorfurtherapart.“ShowButtonBackgrounds”hidethebackgroundpartofyourbuttons(notethismakeskeyboardandjoystickfocusingdifficultfortheusertosee).YoucanalsooverrideyourGUISkin’sbuttonImageStyletosetupthetext/iconrelationshipofyourbuttons.LikewiseyoucansetuptheButtonAllignmenttocontrolhowthecontentinsideofthebuttonispositioned.Labelscanbeturnedonoroffandalsoacustomsizecanbesettodisplaythem.Finally,youcanhaveLDCcreatea“Close”buttonforyourIconGridbyselectingthe“FirstIconIsCloseButton”checkbox.Thistakesthefirstcustombuttonanddrawsitintheformatofaclosebuttoninthetoprightofthewindow.Acustomsizeforthiscanalsobesetwiththe“CloseButtonSize”value.

Finally,conditionallogichasbeenextendedforIconGrids(Seethe“LogicScreens”sectionformoreabouthowlogicworksinLDC).OneachbuttonyoucansethowLDCshouldhandleconditionalbuttonsthatfail.Youcanhideordisablebuttonsandreplacetheirlabels.Thisisgreatforsituationssuchasmerchantscreenswheretheuserdoesn’thaveenoughvirtualcurrencyandyouwanttoreflectsomeinformationbacktotheuser(e.g.“100Credits”become“NotEnoughCredits!”).

AsofLDC4.8.2,youcanalsohandlebuttonsthatPASSconditionallogic.Bydefault,thebuttonwillsimplybevisiblebutyoucannowsetittobe“disabled”instead.Thisallowsyoutocreateinterfacessuchasread-onlylists.

ICONGRIDTIP:IconGridstendtolookalotcoolerwhenyoudisablethebackgroundUI(bydefaultthisisthesmallblackstripatthebottomoftheinterface).Youcaneasilydothisbyclicking“HideUIBackground”intheNavigatetab!

Page 23: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page23

Setting Up A Dialog Screen – The “Logic” Dialog Style

ThepurposeoftheLogicscreenistoallowthesystemtomakeadynamicdecisionbasedonthevalueofLDCTokensorUnity’sPlayerPrefs.Theresultofthisdecisionwillinstantlymoveyoutoadifferentscreen.ThisistheonlyDialogStyleinthesystemthatdoesn’treflectintheGUI,itactslikeanintelligentbridgetootherscreens.

Youcanaddasmanylogic“Events”asyoulikebypressingthe[+]buttonattheendofthelist.Youwillbepresentedwith4elementstocreatethe“condition”ofeachevent:

1)SelectifyouwouldliketotestaTokenoraPlayerPrefsString,FloatorInt.

2)ThenameoftheToken/PlayerPrefsKeytotest.

3)Anoperatortotestwith(“Equals”,“IsNot”,“Lessthan”,etc.)

4)Anumberorsometexttocomparewith.

Letslookatthescreenshotabove:“Token,”“TestToken”,“Equals”,“test”.

Thisconditionwillbetrueifmytokennamed“TestToken”hadpreviouslybeensetwithavalueof“test”.Thiswouldtriggerthenavigationtokickinandinthiscase,we’dmovetoscreen2.

Ifmytokenwasnotsetto“test”thiswouldNOTbetrue,andthesystemwouldmoveontothenextEventandrepeat.IfalltheEventsfail,thenthesystemwillusethe“Default”screen.Inprogrammingtermsthiswouldbethe“Else”block.

AsofLDC4.8.2,wecanalsocontrolHOWthescreennavigateswhenthelogichasbeenperformed.Ratherthanjustasimple“MoveToScreenX”function,wecannowhaveLDCchoosefromarandomrangebetween2numbers(greatforcreatingarandomizedresponses),orgrabthenumericvalueofatokenandusethatdirectly.Thisprovidesahugeamountofflexibilityinthewayyourdialogscreenscannavigateandopensupsomeveryinterestingpossibilities.

NOTES:ThenavigationandActiontabsareunavailablewhenusingthismode.TheMultipleChoiceDialogStylealsosupports“ConditionalEvents”oneachbutton.

Page 24: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page24

Setting Up A Dialog Screen – Navigate Tab

Main Options DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.YoushouldmakesurethateachDialogScreenshouldhaveadifferentIDonthisGameObject.

Next/Yes/No/XScreen: ThesefieldsaredynamicandreflectthetypeofDialogStyleyouselectedintheDialogstab.TheserequireaDialogID.Forexample,ifwetyped“2”intheNextScreenfield,theDialogwillmoveontothescreenthathastheDialogIDof2whenthecurrentonehasfinished.

NOTE:Yourdialogsdonothavetomoveinalinearfashion(1,2,3,4,etc.),althoughthatwouldprobablybetheeasiestwayofdoingit!

SecondsToShow: howlongshouldthisdialogplaybeforemovingontothenextscreenautomatically?Thisshouldbesettothesameamountoftimeastheaudioclipbeingplayed(ifany).OnYes/Noscreens,thisfieldisignored.

HideCustomUIButton: Ifthisischecked,thesystemwillhidethebuttoninthisdialogscreenandrelyon“SecondsToShow”instead.Thistakesawaytheuser’sabilitytoskipthisscreen.

HideUIBackground: Ifthisischecked,thesystemwillhideUIbackground(bydefaultthisistheblackstripatthebottomoftheUI)forthisscreen.

NoPortraitFadeIn: Ifthisischecked,theportraitwillnotplaythefade-intransition(workswellifthesameportraitwasusedinthelastscreen).

NoPortraitFadeOut: Ifchecked,theportraitwillnotplaythefade-Outtransition(workswelliftheNEXTportraittobeusedisthesameasthisscreen).

LastDialog: Ifthisischecked,thewholeDialogUIwillendafterthisscreenisfinished.

DestroyAtEnd: OnlyvisibleiflastDialogisset.Ifthisischecked,theGameObjectthatcontainsthisdialogthreadwillbedestroyed.

NOTE:Youshouldusuallyalwaysdothis,especiallyonAuto-playdialogs.Ifyouneedamorecomplicatedsetupwhereyouwantmanualcontroloverdestroyingthedialogs,leavethisunchecked.

Page 25: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page25

The Last Dialog IfyousetaDialogscreenasthe“LastDialog”,newoptionswillbecomeavailabletoyou.Theseoptionsarespecificallydesignedtohelpyoulinkdifferentdialogsandscenestogether.Forexample,youcansplitupverylargedialogsintosmalleronesmakingthemeasiertomanage,orchangetoadifferentUnityscenewhereanotherdialogissettoAuto-Play,etc.

RestartLevelAtEnd: Assoonasthedialogfadesout,thecurrentUnityscenewillberestarted.

LoadLevelAtEnd: Assoonasthedialogfadesout,thesystemwillattempttoloadalevelwiththenametypedintothisfield.

CreateDialogFromPrefab: Assoonasthedialogfadesout,aprefabwillbeloadedintothescene(YoushouldmakesurethisisanLDCDialogprefabsetto‘Auto-Play’).

FindAndPlayThisDialog: Assoonasthedialogfadesout,thesystemwillattempttofindandplayanotherLDCdialogalreadyinthescenewiththenameyouhavetypedinthisfield.

UseADifferentStartID: AllowsyoutooverridethedefaultstartIDofthenewdialogthread(soyoucanjumptoaspecificscreenwithinanewdialog).

Page 26: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page26

Navigation Callbacks AsofLDCv4.0,youhavetheoptiontocreateNavigationCallbacksfromtheinspectoritself.

NavigationcallbacksallowyoutosendinformationaboutwhatbuttontheuserjustpressedtoanexternalGameObjectusingSendMessage.

GameObjectToFind: EnterthenameoftheGameObjectthatwillreceivethecallback.LDCwillautomaticallyfinditinthesceneforyouatruntime.

FunctionName: Thenameofthefunction/methodthatwillreceivethemessage.ThisfunctionshouldacceptaString[]argument.

StringArgument: Anadditionalstringthatissentwiththeotherdata.

NOTES:

Thecallbacksendsabuilt-inString[]arrayusingSendMessage.Theexamplebelowdemonstrateshowtocatchthefunction.

functionMyFunction(args:String[]){

varldcObjectName:String=args[0]; //ThenameoftheLDCDialog

vardialogID:int=int.Parse(args[1]); //TheDialogIDofthecurrentscreen

varbuttonID:int=int.Parse(args[2]); //ThebuttonIDoftheselectedbutton

varbuttonName:String=args[3]; //Thenameoftheselectedbutton

varcustomString:String=args[4]; //Thecustomstring

}

Page 27: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page27

Setting Up A Dialog Screen – Actions Tab (GameObjects)

DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.YoushouldmakesurethateachDialogScreenshouldhaveadifferentIDonthisGameObject.

CreateObjectsAtStart/End: Usedtocreatealistofprefabsinthesceneatthestart/endofthisDialogScreen.

ActivateObjectsAtStart: UsedtoactivatealistofGameObjectsinthesceneatthestart/endofthisDialogScreen.ThisonlyworksifyourdialogisNOTaprefab.

FindAndActivateObjectsAtStart/End: UsedtoactivatealistofGameObjectsinthesceneatthestart/endofthisDialogScreenbysearchingforthembyname.Thismethodisrecommendedasnodirectreferencesareused.

De-ActivateObjectsAtStart/End: Usedtode-activatealistofGameObjectsinthesceneatthestart/endofthisDialogScreen.ThisonlyworksifyourdialogisNOTaprefab.

FindAndDe-ActivateObjectsAtStart/End: Usedtode-activatealistofGameObjectsinthesceneatthestart/endofthisDialogScreenbysearchingforthembyname.Thismethodisrecommendedasnodirectreferencesareused.

SendMessageAtStart/End: UsedtosendamessagewithanoptionalargumenttoanotherGameObject.ThistriggersafunctioninthatGameObject.Youcanusethistoeffortlesslyconnectwithdifferentscriptswithoutscripting!

DestroyObjectsAtStart/End: UsedtodestroyalistofGameObjectsatthestart/endofthisDialogScreen.OnlyworksifyourdialogisNOTaprefab.

FindAndDestroyObjectsAtStart/End: UsedtofindalistofGameObjectsbynameanddestroythematthestart/endofthisDialogScreen.

Page 28: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page28

Setting Up A Dialog Screen – Actions Tab (Background)

NOTE:UnlikemostsettingsintheDialogScreen,BackgroundandActorLayersareglobaltotheDialogUIobjectanddonotonlyaffectthecurrentscreen.ChangesmadetoaparticularlayerwillstaypersistentuntiltheDialogUIisclosedoruntilyouspecificallytellthatlayertofade-outorhide.

DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.YoushouldmakesurethateachDialogScreenshouldhaveadifferentIDonthisGameObject.

FadeOutAllLayers: Causesalllayerstofadeoutandberesetbythenextscreen.

LyrX: Clickingonacheckboxnexttoalayertellsthesystemyouwillbesettingupalayeractiononthisscreen(theoptionswillopenupunderneathtoreflectthis)

Scenes: Usedtoselectascenefromthelibrary.IftheDialogLibraryisn’tinthescene,thisbuttonwillnotbeavailable.

ScaleMode: UsesUnity’sbuilt-inscalefunctionstoscaleupyourimagetofullscreen.

Display: FadeIn/FadeOutwilltransitionthelayersinorout.Showwillinstantlyshowthelayer,andHidewillimmediatelyhidethelayer.

Page 29: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page29

Setting Up A Dialog Screen – Actions Tab (Actors)

NOTE:UnlikemostsettingsintheDialogScreen,BackgroundandActorLayersareglobaltotheDialogUIobjectanddonotonlyaffectthecurrentscreen.ChangesmadetoaparticularlayerwillstaypersistentuntiltheDialogUIisclosedoruntilyouspecificallytellthatlayertofade-outorhide.

DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.

FadeOutAllLayers: Causesalllayerstofadeoutandberesetbythenextscreen.

LyrX: Clickingonacheckboxnexttoalayertellsthesystemyouwillbesettingupalayeractiononthisscreen(theoptionswillopenupunderneathtoreflectthis)

Cast: UsedtoselectanActorfromthelibrary.IftheDialogLibraryisn’tinthescene,thisbuttonwillnotbeavailable.

Display: FadeIn/FadeOutwilltransitionthelayersinorout.Showwillinstantlyshowthelayer,andHidewillimmediatelyhidethelayer.

SizeIn%: Scalestheimageasapercentage.

Position: Anchorstheimagetoapositionofthescreen(eg,top,bottom-left,middle,etc.)

Offset: Pixeloffsetofthepositionanchor.

MotionFrom: Usedtomakemotiontransitionsfromthetop,left,rightorbottom.Fadingoutwillmaketheimagemovetowardsthatpoint.

Page 30: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page30

Setting Up A Dialog Screen – Actions Tab (Audio)

NOTE:Youcanselectacustomaudiochannel(separatefromthemainspeechchannelfoundonthemainDialogsscreen)toapplyAudioActionsto.

DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.YoushouldmakesurethateachDialogScreenshouldhaveadifferentIDonthisGameObject.

Action: None,Play,FadeInAndPlay,FadeOut,Stop.

LoadFromFilepath: AllowsustotypeinthepathusingtheDialogUIprefix(similartothemainscreen).ThisisbetterfordealingwithlowRAMsituations.

AudioClip/Path: EithertheAudioCliportheFilepathdependingonwhatwasselectedin“LoadAudioFromFilepath”

Volume: 1beingtheloudest.

Pitch: 1beingthedefault(normal)pitch.

Loop: Shouldweloopthisaudio?

FadeDuration: Howlongshouldtheaudiofadetakeinseconds?

Page 31: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page31

Setting Up A Dialog Screen – Actions Tab (Tokens & PlayerPrefs)

NOTE:Inthisscreenyoucancreate,editordeletePlayerPrefs;easilysetupLDCTokens;andperformFileManagementroutinestosave,loadordeleteyourTokens.YoucancreatealistoftokenorPlayerPrefsactionsbyclickingthegreen“+”button.Removethelastiteminthelistbyclickingthered“-”button.

About PlayerPrefs and LDC Tokens AsofLDCv3.5,UnityPlayerPrefsarenowdeeplyintegratedintothesystem.ItisimportanttounderstandtheadvantagesofusingPlayerPrefsandLDCTokenstostoredata.Generally,ifyoudon’tneedtousePlayerPrefsyoushouldstickwithLDCTokens.Theyare‘Typeless’(ie,theyarenotstrictStrings,Floats,Ints,etc.)makingthemeasiertomanage;theycanbeeasilyinjectedintoyourdialogtext(seetheTokenssectionformoreinfo!),andcanbeeffortlesslylocalizedwithinLDCtosupportdifferentvaluesdependingonsystemlanguage.Thatdoesn’tmeantosayPlayerPrefsarenotuseful.InsomecasesyoumaybeusingotherpluginsoryourownscriptsthatwererelyingonPlayerPrefstostorekeysrelevanttoyourgame.Forexample,ifyourcharactercompletedaquestinanRPGgame,iftheyhavereachedacertainareaorlevel,etc.LDCAllowsyoutoset,editandtestthesekeysopeningupalotofpossibilitieswhenworkingbetweenscriptsanddifferentsystems.AlsonotethatLDCcan’tinjectthekeysfromPlayerPrefsintodialogsdirectly,norcantheybelocalized.Soinconclusion,itisrecommendedtouseTokensforthingslike“PlayerName”,“Age”,“Currency”,anythingthatyoumightneedtouseordisplayinadialogtotheplayer.IfyouneedtousePlayerPrefs,trytousetheseforthingsthathappenbehindthescenessuchas“PlayerDiscoveredLevel2”,“FoundGoldKey”,“HasSword”,etc.

Page 32: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page32

Setup Unity PlayerPrefs Action: “SetString/Float/Int”createsanewkey(orreplacesanexistingkey),“AddtoFloat/Int”addsavaluetoanexistingkey(orcreatesanewkeywiththatvalueifitdoesn’texist),“SubtractFromFloat/Int”subtractsavaluefromanexistingKey(orcreatesanewkeyifitdoesn’texist.),“DeleteKey”willtrytodeleteaspecifickey,and“DeleteAllKeys”willdeleteAllKeysfromPlayerPrefs.

Token: ThenameofthePlayerPrefsKeyweshouldapplythisactionto.NOTE:Ifyouareusing“SavePrefixes”inDialogUI,thiswillbeautomaticallyaddedtothebeginningoftheKeyshere.

Value: UsedasanargumenttothecurrentAction.

Setup LDC Tokens Token: Whichtokenshouldweapplythisactionto?

Action: Setreplacesatoken,AddandSubtractattemptstotreatthistokenlikeanumberandapplysimplemathusingtheValuefield.

Value: UsedasanargumenttothecurrentAction.If“Set”isselected,thevaluewillsimplyreplacetheoldone,if“Add”isselected,thenitwillattempttoAddthe“Value”totheexistingToken.

Localize(GlobeIcon): ApplyalocalizedValue.

LocalizedValues: Wecanapplydifferentvaluesdependingonwhatlanguageiscurrentlyselected.

File Management FileManagement: Wecaneasilychoosetosave,loadordeleteourTokenstoPlayerPrefsusingthecurrentlyselected‘SavePrefix’.TakealookattheFileManagementformoreinfo!

Page 33: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page33

Setting Up A Dialog Screen – Actions Tab ( Localization )

InthisscreenitispossibletochangeLDC’slanguageandGUISkin.

SetNewDialogLanguage: AutoDetectwillusethechosendetectionsysteminDialogLocalizationinordertodetectthelanguage.Theotherlanguagechoiceswillselectthatlanguagedirectly.

NOTE:ChangingthelanguageusingthisactionwillalsoautomaticallysetthePlayerPrefsstringthathasbeensetupinDialogLocalization(ifyouhaveselectedtousethePlayerPrefsKeydetectionmode).

AlsoUpdateTheGUISkin: AutomaticallyreloadsLDC’sGUISkintousethesettingssetupintheDialogOnGUIcomponent.

Page 34: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page34

Setting Up A Dialog Screen – Actions Tab ( 3rd Party / uSequencer )

NOTE:ThedeveloperofuSequencerandIhaveteameduptoprovideoutoftheboxintegrationbetweenbothofourtools.NowyoucaneasilycontrolsequencesdirectlyfromLDCusingtheeasytouseintuitiveeditorsthatyou’reusedto!

uSequencerGameObject: YoucandragthesequenceintothisslotifyourDialogisnotsetupasaprefab.(UseFindByNameifitis!)

ORFindByName: AccessthesequencerbytypinginthenameoftheGameObject.(Perfectifyouareusingaprefab!)

SetupSequence: Opensupsomeextraoptionstosetupthesequence.

SetPlaybackTime: Settheplaybacktimeofthesequence.

SetPlaybackRate: Settheplaybackrateofthesequence.

Performthisactionatthestart/EndoftheDialogScreen:

TriggerafunctiontoPlay/Pause/Stop/Skipthesequencewhenthedialogscreenfirstappears,orwhenitends.

Page 35: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page35

Setting Up A Dialog Screen – Actions Tab ( 3rd Party / RT-Voice )

NOTE:NowLDCcansetupvoiceprofilesandhaveRT-Voicespeakyourdialogtextwithtext-to-speech!PleasenotethatRT-VoiceonlyworksonMacandWindowsstandalonebuilds.

RT-VoiceActions: Choosetosaythetitle,thedialogtext,thetitleandthedialogtext,ortosilenceallvoices.

SelectAVoice: SelectAVoicethatyouhavealreadysetupintheDialogUIcomponent:

SettingUpVoiceProfilesForRT-Voice:

InsideDialogUI>3rdParty>RT-Voice,youcancreatenewvoicesthatthesystemcanuse.Foreachvoiceyoucreate,youwillnoticeacorrespondingnamewillbeavailableintheDialogScreens.EachvoicemusthaveanRT-VoiceculturecodeandavoiceID(whichcanbedifferentonbothmacandwindows).Youcanalsoselectoptionsthatlimitaspecificvoicetospeakingonlyifit’sintheEditor,orifanexistingAudioCliphasn’tbeensetupinaDialogScreen.

Page 36: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page36

Setting Up A Dialog Screen – Localize Tab

DialogID: ThisIDisusedtoidentifythisspecificdialogscreen.YoushouldmakesurethateachDialogScreenshouldhaveadifferentIDonthisGameObject.

SelectLanguage: Usedtoselectalocalizationlanguage.

English/Translation: TheEnglishfieldsoftheDialogscreenareconvenientlyplacedontheleftsoyoucantypeintheactivetranslationontheright.

OverrideAudio: Checkthisifyouhavelocalizedaudiofilestoo.

NewAudioFilepath: Typeinthefilepathtothelocalizedaudiofile.Youshouldusethesameformatasthe“AudioPath”intheDialogstab.

Pitch: Usedtochooseanewaudiopitchforthelocalizedaudioclip.

CustomButtons: Yourcustombuttonnameswillappearherealsoiftheyhavebeensetup.

CustomTokens: Yourcustombuttonnameswillappearherealsoiftheyhavebeensetup.

TranslateToX: AllowsyoutoautomaticallytranslateyourEnglishtexttotheselectedLanguageonthisscreen.NOTE:Chinese,KoreanandJapanesearenotcurrentlysupported.

TranslateAll: AllowsyoutoautomaticallytranslateyourEnglishtexttoALLsupportedlanguagesonthisscreen.NOTE:KoreanandJapanesetranslationsarecurrentlyinbeta.

NOTE:WhenusingAutomaticTranslations,itisimportanttonotchangetheselectedGameObjectintheHierarchyuntilthetranslationroutinehasfinished.ThiswillcausetheLDCinspectortocloseabruptlyandinterruptyourconnectiontothetranslationservers!

Page 37: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page37

Dialog Library / Cast, Scenes, and Buttons

The“DialogLibrary”GameObjectconsistsofthe“DialogCast”,“DialogScenes”and“DialogButtons”editor.ThisisadatabasethatisusedtosetupthegraphicsandanimationsusedinyourDialogs.Youshouldonlyhave1DialogLibraryineachscene,anditshouldmostdefinitelybesavedasaprefabtomakethingseasier!

Aswellasallowingyoutoorganizeyourgraphicsandanimationsintogroups,theeasytouseeditorsallowyoutodeleteentireCastGroupsbyclickingtheouter“-”buttons,oraddnewonesbyclickingthebottomgreen“+”sign.Also,individualimages/animationscanbeaddedanddeletedinthesameway.

Setting Up Animations Youcaneasilysetupanimationsbyclicking“UseAnimation”andthenaddingframesasaTexture2D(Note:Theyshouldallbethesamesize).Youcanchangetheanimationspeedbymovingthesliderleftandrightandalsotellitwhichframetoloopbackto.

Accessing the Cast from the Dialog Screen IftheappropriateLibraryisavailable,a“ViewCast”buttonwillappearbytheportraiticonintheDialogScreen,thecustombuttoniconfields,andalsounderbackgroundandactorlayers.ClickingthisallowsyoutoeasilyselectanActor/Backgroundwithasingleclick!

REMINDER:Ifyouaregoingtousethisfeature,youshouldsavetheDialogLibraryGameObjecttoaprefabandusethatineverysceneofyourgame.Thiswillmakesurethatthecastremainsavailableatalltimes.Ifyouareusinganimations,youMUSTkeepthisprefabinthescene!

Page 38: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page38

Dialog UI - Settings NOTE:InfoaboutLocalizedSkinscanbefoundin“TheGUI”sectionofthedocumentation.

Transitions FadeDuration: HowlongtheUItransitionsareinseconds.

BackgroundFadeDuration: HowlongthebackgroundUItakestofadein.

BackgroundFadeOverride: FadespeedwhenbeingoverriddenbyaDialogScreen.

UsePortraitFades: Allowtheportrait/icontobefadedin/out.

UseButtonFades: AllowtheUIbuttonstobefadedin/out.

UseTextFades: AllowtheUItexttobefadedin/out.

UsePortraitTransitions: Allowtheportrait/icontotweenin/out.

UseButtonTransitions: Allowthebuttonstotweenin/out.

DefaultScreenTransitions: whicheffectshouldbeconsideredthedefault?

UI Options:

TitleTextShadows: DrawsashadowfortheTitle/ActorUIText.

BodyTextShadows: DrawsashadowforthemainbodyUIText.

HideBackgroundImage: HidesthemainbackgroundelementfromtheUI.

HideChoicePanelUI: Hidesthebackgroundbehindthemultiple-choiceUI.

HideAllText: HidesalltextelementsfromtheUI(NotButtons).

HideTitleText: HidesallactornamesandtitlesfromtheUI.

HideBodyText: HidesallmaindialogtextfromtheUI.

HideAllSingleButtons: HidesallsinglebuttonsfromtheUI.

Page 39: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page39

IgnoreAllDialogDuration: Ignoresthetimeoutofsinglebuttondialogs.Requirestheusertopressabuttontoprogresstothenextscreen.

ResizeTextWithoutPortraits: WidensthetextareaoftheUIifnoportraitsaresetup.

FadeOutWhenScreenEnds: Fadesoutspeechaudiowhenascreenends.

StopAudioWhenScreenEnds: Whenanindividualscreenends,audioisstoppedearly.

StopAudioIfDialogEnds: StopsanyLDCspeechfromplayingwhenadialogends.

Text Effects:

ByDefault,ScrollableTextis: Defaultscrollabletextsetting.

AutomaticScrollingSpeed: Defaultspeedforautomaticscrollingtext.

ReduceScrollAreaHeight: Clipsextraspacefromthebottomofthetext.

TapToScrollManually: Ifauserclicks/tapsonanAutomaticScrollingNextDialog,thefunctionalitywillchangetoManualScrolling.

UseTypewriterByDefault: Textisdisplayed1characteratatimelikeatypewriterbydefault.

TypewriterEffectSpeed: howfasteachcharacterisdisplayed.

FinishEarlyOnUserInput: Ifauserclicksthemouseortouchesthescreen,thetypewriterwillimmediatelycomplete.

PlayTypewriterAudioClip: PlaysanAudioClipduringTypewritereffects.

Input Options:

SelectGUIButton/ItemWithTheseKeycodes:Allowsyoutosetupkeyboard/joystickkeystoselectbuttonsintheUI.SimplychoosefromoneoftheKeyCodesinthedropdownmenu.

FocusNextGUIButton/ItemWithTheseKeycodes: Allowsyoutosetupkeyboard/joystickkeystofocusthenextUIelement.SimplychoosefromoneoftheKeyCodesinthedropdownmenu.

FocusPreviousGUIButton/ItemWithTheseKeycodes: Allowsyoutosetupkeyboard/joystickkeystofocusthepreviousUIelement.SimplychoosefromoneoftheKeyCodesinthedropdownmenu.

FocusGUIButtons/ItemsWithTheseAxes: AllowsyoutouseaninputaxisalreadysetupinUnity’sInputpanetoselectbuttonsintheUI.Typethenameoftheaxisandselectifyouwanttoinvertit.

PlayWhenButtonIsSelected: PlaysanAudioClipwhenaGUIitemisselected.

PlayWhenFocusChanges: PlaysanAudioClipwhentheGUIfocuschanges.

File Management Options: NOTE:FormoreinformationaboutFileManagementandhowitworks,pleaserefertothefull“FileManagement”sectionfoundlaterinthedocumentation.

UseGlobalTokens: Tokenswillbepersistentacrossdifferentlevels.

UseFileManagement: FileManagementisenabled.

Page 40: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page40

LoadTokensOnAwake: TokensareautomaticallyloadedonAwake().

SaveTokensOnDestroy: TokensareautomaticallysavedonDestroy().

SaveTokensOnPause: TokensareautomaticallysavedOnApplicationPause().

AudioFilepathPrefix: ThisisawayofshorteningalloftheaudiofilepathsfromtheDialogstab.Thisstringisputinfrontofallaudiofilepaths.Example:Let’sassumeyouhadanaudiofilelocatedatResources/Audio/Speech/No.wav.Ifyouchangedtheprefixto“Audio/Speech/”allyou’dneedtotypeinastheAudiofilepathintheDialogstabis"No",anditshouldworkfine!

Miscellaneous:

DebugSystemMessages: AllowLDCtoshowimportantsystemmessagesintheUnityConsole.

DebugActionMessages: AllowLDCtoshowmessagesrelatingtoLDCactionsintheUnityConsole.

DebugLogicMessages: AllowLDCtoshowmessagesrelatingtologicscreensandtheprocessingoftokensintheUnityConsole.

Page 41: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page41

$Token Injectors Tokensaresimplevariablesinthesystemthatcanbeusedtostoreinformationliketheplayer’sname,age,inventory,status,etc.ItcanalsobeusedveryeasilyinconjunctionwiththeDataEntryDialogStyle,aswellasexternallyusingtheAPI(seethecommonscriptspageforexamples!)

How To Setup A Token YoucansetupTokensintheDialogUIGameObject.OpentheTokenstab;addanewentryandgiveitaname.Youcanalsochoosetoaddavaluetoitrightatthestart.That’sit!Younowhaveatokenyoucanusetostoredata!

Intheexampleabove,we’vesetup2tokens,1called“PlayerName”,andanothercalled“Age”.“PlayerName”hasavalueof“Mike”,and“Age”hasavalueof18.

NOTE:Enabling“GlobalTokens”in“Options”,allowschangestoyourtokenstofollowyouacrossdifferentlevels.MakesureyouhavethesameDialogUIprefabinallofyourscenesforthistowork!IfyouwanttousetheFileManagementfeatures,youmustalsoenableGlobalTokens!

How To Use A Token In A Dialog YoucaneasilyusetokensinaDialog,likethis:

NOTE:YoucanuseTokensintheDialogText,ortheTitleintheexactsameway!

Page 42: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page42

Asyoucansee,we’vewrittenthetokenname“PlayerName”inthedialogbutweputadollarsign“$”inthefrontofthetext.Thistellsthesystemtoreplaceitwiththevalueofthetoken.

TheUIwillthenendupwiththeresult:

“HiMike,I’mgoingtotellyouaveryshortstory..”

NOTE:IfatokencouldnotbefoundintheTokenslist,thesystemwillsimplyignoreit.

Page 43: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page43

@Style Injectors

StyleInjectorsareanincrediblyeasywayofaddingrichtextandcoloranimationsintoyourtext!Yousetthemupinasimilarwaytotokens.Youcreatealistofcustomstylesandyousetupthepropertiestheyhave(colors,bold,italic,size,etc).Infact,LDC’sInjectorscanalsobeusedoutsideofthesystemtoowiththeAPI!Youcaninjectstylesandtokensintoanystringthatsupportsrichtext(includingUnity’snewuGUIsystem!)

Anotherawesomethingaboutinjectorsarehoweasytheyaretouse.UnlikeothertagbasedscriptinglikehtmlorUnity’srichtextmarkupitself,allyouneedtodoisaddthe“@”symbolandyourinjectorbyname-youdon’tevenneedaclosingbracket!LDCgeneratesthecodeforyouonthefly!

How To Setup A Custom Style

YoucanaddnewstyleinspectorsintheDialogUI>Stylestab.Intheexampleabove,we’vesetupanewstylecalled“YellowShine”.We’vesetittobeboldandtohaveacoloranimationmakingitblendbetweentwoshadesofyellow.NOTE:Youshouldalwayskeepthe“Normal”style(thisisexplainedinthenextsection).

Page 44: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page44

Properties Of A Style Injector ThefollowingpropertiesareavailableinaStyleInjector:

Name: Thenameofthestyle.Don’taddthe“@”characterhere.Bold: makethistextbold.Italic: writethistextinitalics.FontSize: Useacustomsizeofthistext.0=default.ColorAction: None(Don’tchangecolor),SetTextColor(usesthe“TextColor”fieldtochangethetextcolor)orFadeBetweenTwoTextColors(blendsbetweenthetwocolors).TextColor: Thenewcolorofthetext(ifsetabove).AltColor: Thealternatecolortouseifwe’vechosenacoloranimation.Color

How To Use A Style Injector In A Dialog Soifweuseoneofthedefaultstylescalled“Bold”(whichsetsourtexttobold),wewouldaddittothetextlikethis:

Theresultwillbe:

Thistextisbold!

Youmayhavenoticedthatwedidn’tneedtotellLDCwhentoclosetheboldeffect,that’soneofthecoolthingsaboutStyleinjectors,thescriptingisdesignedtobeassimpleandunintrusiveaspossible!Sowhatifwewanttomakethenextpartofthesentencegobacktonormal?Easy,weusethe“Normal”styleandwriteitintothesentence:

Theresultwillbe:

Thistextisbold!Nowthissentenceisnormal.

Page 45: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page45

Wecanaddasmanystylesaswewantinthetext,inthenextexamplewe’llmakeanewlineitalic,todothiswe’llusethedefault“Italic”style:

Theresultwillbe:

Thistextisbold!Nowthissentenceisnormal.

Thisiswritteninitalics!

How To Use Styles And Tokens In A Dialog Wecanmixandmatchstylesandtokensasweplease!We’llusethe$PlayerNametokentograbtheplayer’snameandinsertitintotheprevioussentence:

(Assuming$PlayerNameis“Mike”,)theresultwillbe:

Thistextisbold!Nowthissentenceisnormal.

Mikeiswritteninitalics!

Page 46: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page46

@System Injectors Notonlyareinjectorsabletoinjectpowerfultext“styles”and“tokens”,theyalsoprovidesomepowerfulkeywordstoaddcadence(delays)toyourwordsandtoevenchangethespeedofthetypewriterorscrollingsystem!

Cadence Keywords Youcanaddthe“@Wait”keywordtoaddpausesinthetypewritereffect.Thisisagreatwaytoenhancethenarrativewithnaturalpauses.NOTE:AsimulatedtypewritersecondisbasedonthedefaulttypewriterspeedsetupinDialogUI>Options.@Wait10 Waits10%ofthetypewriter’ssimulatedsecond.

@Wait20 Waits20%ofthetypewriter’ssimulatedsecond.

@Wait30 Waits30%ofthetypewriter’ssimulatedsecond.

@Wait40 Waits40%ofthetypewriter’ssimulatedsecond.

@Wait40 Waits50%ofthetypewriter’ssimulatedsecond.

@Wait60 Waits60%ofthetypewriter’ssimulatedsecond.

@Wait70 Waits70%ofthetypewriter’ssimulatedsecond.

@Wait80 Waits80%ofthetypewriter’ssimulatedsecond.

@Wait90 Waits90%ofthetypewriter’ssimulatedsecond.

@Wait100 Waits1simulatedsecond.

@Wait200 Waits2simulatedseconds.

@Wait300 Waits3simulatedseconds.

@Wait400 Waits4simulatedseconds.

@Wait500 Waits5simulatedseconds.

CadenceExample:

Thefollowingtextwillpause2secondsafterthetypewriterreachestheword“thinking,”beforecontinuing.

Page 47: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page47

Typewriter Speed Keywords Youcanusethe“@Type”keywordtochangehowfastthetypewriteristypingeachletter.Youcanchangethisasmanytimesasyouwantwithinthesametext!NOTE:ThedefaulttypewriterspeedcanbefoundinDialogUI>Options.Thesekeywordsonlyaffectthecurrentscreen.@Type10 Typesat10%ofthetypewriter’sdefaultspeed.

@Type20 Typesat20ofthetypewriter’sdefaultspeed.

@Type30 Typesat30%ofthetypewriter’sdefaultspeed.

@Type40 Typesat40%ofthetypewriter’sdefaultspeed..

@Type40 Typesat50%ofthetypewriter’sdefaultspeed.

@Type60 Typesat60%ofthetypewriter’sdefaultspeed.

@Type70 Typesat70ofthetypewriter’sdefaultspeed.

@Type80 Typesat80%ofthetypewriter’sdefaultspeed.

@Type90 Typesat90%ofthetypewriter’sdefaultspeed.

@Type100 Typesat100%ofthetypewriter’sdefaultspeed.

@Type150 Typesat150%ofthetypewriter’sdefaultspeed.

@Type200 Typesat200%ofthetypewriter’sdefaultspeed.

@Type300 Typesat300%ofthetypewriter’sdefaultspeed.

@Type400 Typesat400%ofthetypewriter’sdefaultspeed.

@Type500 Typesat500%ofthetypewriter’sdefaultspeed.

TypewriterSpeedExample:

Thefollowingtypesat10%ofthedefaultspeed,thenswitchestonormalspeedonthesecondline,andfinallyshootsupto500%speedonthethirdline!

Page 48: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page48

Automatic Scrolling Speed Keywords Youcanusethe“@Scroll”keywordtochangehowfasttheautomaticscrollingfunctionismovingthroughthetext.Youcanchangethisasmanytimesasyouwantwithinthesametext!NOTE:ThedefaultautomaticscrollingspeedcanbefoundinDialogUI>Options.@Scroll10 Scrollsat10%ofthedefaultautomaticscrollingspeed.

@Scroll20 Scrollsat20ofthedefaultautomaticscrollingspeed

@Scroll30 Scrollsat30%ofthedefaultautomaticscrollingspeed

@Scroll40 Scrollsat40%ofthedefaultautomaticscrollingspeed

@Scroll40 Scrollsat50%ofthedefaultautomaticscrollingspeed

@Scroll60 Scrollsat60%ofthedefaultautomaticscrollingspeed

@Scroll70 Scrollsat70ofthedefaultautomaticscrollingspeed

@Scroll80 Scrollsat80%ofthedefaultautomaticscrollingspeed

@Scroll90 Scrollsat90%ofthedefaultautomaticscrollingspeed

@Scroll100 Scrollsat100%ofthedefaultautomaticscrollingspeed

@Scroll150 Scrollsat150%ofthedefaultautomaticscrollingspeed

@Scroll200 Scrollsat200%ofthedefaultautomaticscrollingspeed

@Scroll300 Scrollsat300%ofthedefaultautomaticscrollingspeed

@Scroll400 Scrollsat400%ofthedefaultautomaticscrollingspeed

@Scroll500 Scrollsat500%ofthedefaultautomaticscrollingspeed

ScrollingSpeedExample:

Thefollowingtextwillbeginscrollingat30%ofthedefaultspeedatstart.

Page 49: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page49

File Management (Save / Load)

FileManagementallowsyoutoeasilysave,loadanddeleteyourtokenstoandfromUnity’sPlayerPrefsfile.Itsupportssaveslots(oruseraccounts)withinthesamefileallowingyoutohavemultiplecharactersoraccountsinyourprojects!

NOTE:GlobalTokensmustbeenabledinOptionstousetheFileManagementfeatures!

File Management Explained

IfyouwanttouseFileManagement,youmustfirstgototheDialogUI>Settings>FileManagementtaboftheDialogUIComponent.

TheSavePrefixisanextremelyeasywayofchangingbetweendifferentsaveslots.Wheneveryouchangethiswithadifferentstring,itwillbecomeakeyforauniquesaveslot.Forexample,youcancallit“SaveSlot1”,“SaveSlot2”,etc.ifyouarenotusingmultiplesaveslots,itisfinetoleavethisblank.

“LoadOnAwake”willautomaticallyloadthetokensatthebeginningofthelevelusingthecurrentsaveprefix.

“SaveOnDestroy”willsaveyourtokenswhenevertheDialogUIcomponentisabouttobedestroyed.Fromapracticalpointfromview,thismeansthatUnityautomaticallysavesitattheendofthelevel!

“SaveOnApplicationPause”allowsforautomaticallysavingtokenswhenevertheuserpausesthegame.Particularlyusefulonmobiledevices!

Page 50: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page50

Dialog Actions Youcanalsosave,loadanddeleteTokensusingtheTokenActiontabsineachDialogScreen!

Advanced Implementations IfyouwantfullcontroloverFileManagement,enableitbutuncheck“LoadOnAwake”,“SaveOnDestroy”and“SaveOnApplicationPause”.Youcanaccessallofthesefunctionseasilyviascript.YoucanfindthemintheAPIsection!

Page 51: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page51

LDC API - Common Scripts

LDCusesanamespacesodon’tforgettoaddthistothetopofyourscripts:

usingHellTap.LDC;

//HOWTOGETTHECURRENTLYACTIVELOCALIZATION//Thissimplestaticstringreturnsthecurrentlocalization//Returns“English”,”French”,”German”,etc.Debug.Log(DialogLocalization.language); //HOWTOPLAYADIALOGBYSCRIPT–FORCECLOSE//Thissimplemethoddoesn’tcheckifadialogisalreadyplayingandwillattempttoforceanyotherdialogtostopfirst.DialogControllerdialog;voidStart(){

dialog.Play();}//HOWTOPLAYADIALOGBYSCRIPTWHENOTHERDIALOGSAREDONE//Thisscriptcheckstomakesurethatnootherdialogsarestillplayingandthenattemptstoplaythedialogvariable.Thiswillmakesurenootherdialogthreadiscutshort.Thedialogwillonlyplayonce.DialogControllerdialog;boolplayed=false;voidUpdate(){

if(!played&&DialogUI.ended){dialog.Play();played=true;

}}//HOWTOGETATOKEN//Thisscriptshowshowtogetatokenasastringorasafloat.stringwhatIsMyName=DialogUI.GetToken(“PlayerName”);floatwhatIsMyAge=DialogUI.GetTokenAsFloat(“Age”);//HOWTOSETATOKEN//ThisscriptshowshowtosetatokenaseitheraStringorasafloatDialogUI.SetToken(“PlayerName”,”Peter”);DialogUI.SetToken(“Age”,18f);

Page 52: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page52

//HOWTOSETANEWLANGUAGE//Usethismethodtodirectlychangethelanguage.YoucanoptionallyupdatetheGUISkinbysettingthesecondargumenttotrue.DialogUI.API_ChangeLanguage(action:DS_SetNewLanguage,updateGUISkin:boolean);

//EnumOptions:

DS_SetNewLanguage.No //Thelanguageisn’tchanged.DS_SetNewLanguage.AutoDetect //UseLDC’ssystemDetection.DS_SetNewLanguage.English //UseSpecificLanguageDS_SetNewLanguage.Chinese //UseSpecificLanguageDS_SetNewLanguage.Korean //UseSpecificLanguageDS_SetNewLanguage.Japanese //UseSpecificLanguageDS_SetNewLanguage.Spanish //UseSpecificLanguageDS_SetNewLanguage.Italian //UseSpecificLanguageDS_SetNewLanguage.German //UseSpecificLanguageDS_SetNewLanguage.French //UseSpecificLanguageDS_SetNewLanguage.Portuguese //UseSpecificLanguageDS_SetNewLanguage.Russian //UseSpecificLanguage

//EXAMPLEUSAGE:SetsLanguagetoEnglishandupdatestheGUISkin

DialogUI.API_ChangeLanguage(DS_SetNewLanguage.English,true);

//ALTERNATIVEMETHOD//Usethismethodtodirectlychangethelanguageusinganintinstead.YoucanoptionallyupdatetheGUISkinbysettingthesecondargumenttotrue.DialogUI.API_ChangeLanguage(action:int,updateGUISkin:boolean);

//IntOptions:

0=AutoDetect1=English2=Chinese3=Korean4=Japanese5=Spanish6=Italian7=German8=French9=Portuguese10=Russian//EXAMPLEUSAGE:SetsLanguagetoEnglishandupdatestheGUISkin

DialogUI.API_ChangeLanguage(1,true);

Page 53: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page53

LDC API – Core Functions

YoucancreateyourownscriptstousetheLDCpluginusingthesepowerful,yetsimpletousefunctions!Herearetheavailablemethods:

DialogUI.API_CreateDialog(GameObject)ThisfunctionwaitsforanycurrentDialogtofinish,andtheninstantiatesanauto-playDialog.DialogUI.API_CreateDialogNow(GameObject)Thisfunctionimmediatelyinstantiatesanauto-playDialog.ThisforcesanyexistingDialogtofinishearly).DialogUI.API_CreateDialog(GameObject,int)ThisfunctionwaitsforanycurrentDialogtofinish,andtheninstantiatesanauto-playDialog.AllowsustopassaninttooverridethestartIDofthedialog.DialogUI.API_CreateDialogNow(GameObject,int)Thisfunctionimmediatelyinstantiatesanauto-playDialog.ThisforcesanyexistingDialogtofinishearly).AllowsustopassaninttooverridethestartIDofthedialog.DialogUI.API_PlayDialog(DialogController)ThisfunctionwaitsforanycurrentDialogtofinish,andthentriggersaDialogtoplay.DialogUI.API_PlayDialogNow(DialogController)ThisfunctionimmediatelytriggersaDialogtoplay.ThisforcesanyexistingDialogtofinishearly).DialogUI.API_SetToken(string,string)ThefirstStringisthenameoftheTokentoset;thesecondstringisthevaluetosetitto.DialogUI.API_SetToken(string,float)TheStringisthenameoftheTokentoset,thefloatisthevaluetosetitto.DialogUI.API_GetTokenAsString(string):stringFindsatokenthathasanamematchingtheStringargument.Returnsthevalueasastring.DialogUI.API_GetTokenAsFloat(string):floatFindsatokenthathasanamematchingtheStringargument.Returnsthevalueasafloat.DialogUI.API_GetTokenIndex(string):intFindsatokenthatmatchestheStringargument.Returnstheindexofthearrayasanint.

Page 54: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page54

DialogUI.API_StopAllDialogs()ForcesAnyplayingDialogtocloseearly.DialogUI.API_SaveTokensToDisk()SavesalltokensofthecurrentsaveprefixtoPlayerPrefs.GlobalTokensmustbeenabled.DialogUI.API_LoadTokensFromDisk()LoadsalltokensofthecurrentsaveprefixfromPlayerPrefs.GlobalTokensmustbeenabled.DialogUI.API_DeleteTokensFromDisk()DeletesalltokensofthecurrentsaveprefixfromPlayerPrefs.GlobalTokensmustbeenabled.DialogUI.API_SetTokenSavePrefix(string)SetanewprefixforsavingtokenstoPlayerPrefs.Allowsfordifferentsaveslots.DialogUI.API_LoadLevel(string)ThisfunctionwaitsforanycurrentDialogtofinish,andthenattemptstoloadthelevelnamepassedtoit.DialogUI.API_TextInjector(string):StringThisfunctioninjectsalltokensandrichtextstylesintothetextandreturnsitforuseoutsideofthesytem.Thistextshouldnotalreadyhaverichtexttagsasitmaycauseproblems.DialogUI.API_ChangeLanguage(int)ThisfunctionallowsustochangetheDialogLocalizationsystemlanguage(andupdatetheGUISkinsautomatically)bypassinganint.0=AutoDetect,1=English,2=Chinese,3=Korean,4=Japanese,5=Spanish,6=Italian,7=German,8=French,9=Portuguese,10=Russian. DialogUI.API_ChangeLanguage(int,bool)ThisfunctionallowsustochangetheDialogLocalizationsystemlanguagebypassinganintaswellassendingabooleantoupdatetheGUIskins.0=AutoDetect,1=English,2=Chinese,3=Korean,4=Japanese,5=Spanish,6=Italian,7=German,8=French, 9=Portuguese,10=Russian.

Page 55: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page55

LDC API – Building Dialogs

Inthissectionyou’lllearnhowtocreatedynamicDialogThreadscompletelyviatheAPI.Thisisverypowerfulandallowsforcustomimplementations.

Actionsandlocalizationsarenotavailablefordynamicdialogsinthetraditionalsenseasyourscriptsdynamicallygeneratethesedialogs.Although,youcanaddlocalizationtothesescriptsbyusingsomethinglikethis:

If(DialogLocalization.language==“English”){

myText=“ThistextisinEnglish”;

}

UsingDialogLocalization.language,youcancomparelanguagestochangedialogstrings.Actionscanbeimplementedinanywayyouwant(asyouaretheonescripting!).ThesefunctionsmerelyputtogetherthebarebonesofthedialogstylesandUIoptionstogetworkingdialogscreensandnavigation!=)

YoucanalsouseFunctioncallbacksatthestartandendofeachscreen,givingyoutotalcontrol!

NOTE:Checkoutthe“07APIDynamicDialogs”Demothatcomeswiththepluginforanin-depthdemoscript(you’llfindthisin“TheLDCDemos”folder).

Step 1 – The Core Template

Thereare2stepsincreatingadynamicDialogThread.ThefirstthingweneedtodoiscreatetheLDCbasictemplate.ThisisachievedbyusingtheAPI_DialogCreate()function.

Youcanalsosend2argumentstosetuptheAutoplayflag,andhowlongtodelaybeforestartingtheDialog.HereisareallifeexampleofhowtosetupthebasicTemplatewithcustomarguments:

//CreateanewDialogObjectwithAutoplayenabled(true),startingafter1second.

//TheGameObjectwillbenamed“MyDialog”

GameObjectgo=DialogUI.API_DialogCreate(true,1,“MyDialog”);

Atthispoint,we’llhaveaGameObjectwithaDialogControllerthat’ssetupforAutoplayandacustomdelay.

Now,weneedtodoaddtheindividualscreens.

Page 56: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page56

Step 2 – Introduction WhenyouaresettingupeachDialogscreen,imagineyouarestillworkingintheeditor.Simplycallthecorrectfunctionandthatscreenwillbeadded!ThefirstargumentshouldbetheGameObjectyoucreatedinthefirststep!ThefollowingfunctionsallreturnthecreatedDialogScreen,althoughinmostcasesyouwillsimplycallthefunctionswithoutstoringitinareturnvariable.

Step 2a – Dynamic Next Screen Thisisthefunctionandargumentstosetupa“Next”screen:DialogUI.API_DialogAddNextScreen(

go:GameObject,dialogID:int,portrait:Texture2D,title:String,dialogText:string,typewriterOptions:DIALOG_OVERRIDE_YESNO,scrollingOptions:DIALOG_OVERRIDE_SCROLLING,audioFilePath:string,secondsToDisplay:float,hideNextButton:boolean,hideDialogBackground:boolean,endAfterThis:boolean,destroyAfterThis:boolean,noPortraitFadeIn:boolean,noPortraitFadeOut:boolean,screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,nextID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);Usetheseenumsforthetypewriter,Scrollingandtransitionoptions:

DIALOG_OVERRIDE_YESNO {UseDefault,Yes,No}

DIALOG_OVERRIDE_SCROLLING {UseDefault,Off,AutomaticScrolling,ManualScrollingWithVerticalBar}

DIALOG_OVERRIDE_TRANSITION {UseDefault,None,PushLeft,PushRight,PushDown,PushUp,InAndOutFromLeft,InAndOutFromRight,InAndOutFromTop,InAndOutFromBottom,Popup,Eyelids,BarnDoors,Zoom,ZoomHorizontal,ZoomVertical,Spin,SpinPopup,SpinZoom}

Page 57: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page57

Step 2b – Dynamic One-Button Screen

Thisisthefunctionandargumentstosetupa“OneButton”screen:

DialogUI.API_DialogAddOneButtonScreen( go:GameObject, dialogID:int, portrait:Texture2D, title:String, dialogText:string,

typewriterOptions:DIALOG_OVERRIDE_YESNO,scrollingOptions:DIALOG_OVERRIDE_SCROLLING,

audioFilePath:string, secondsToDisplay:float, hideNextButton:boolean,

hideDialogBackground:boolean, endAfterThis:boolean, destroyAfterThis:boolean, noPortraitFadeIn:boolean, noPortraitFadeOut:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

buttonLabel:String,nextID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 58: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page58

Step 2c – Dynamic Yes Or No Screen

Thisisthefunctionandargumentstosetupa“YesOrNo”screen:

DialogUI.API_DialogAddYesNoScreen( go:GameObject dialogID:int, portrait:Texture2D, title:String, dialogText:string,

typewriterOptions:DIALOG_OVERRIDE_YESNO,scrollingOptions:DIALOG_OVERRIDE_SCROLLING,

audioFilePath:string,hideDialogBackground:boolean,

endAfterThis:boolean, destroyAfterThis:boolean, noPortraitFadeIn:boolean, noPortraitFadeOut:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

yesID:int,noID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 59: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page59

Step 2d – Dynamic Two Button Screen

Thisisthefunctionandargumentstosetupa“TwoButton”screen:

DialogUI.API_DialogAddTwoButtonScreen( go:GameObject, dialogID:int, portrait:Texture2D, title:String, dialogText:string,

typewriterOptions:DIALOG_OVERRIDE_YESNO,scrollingOptions:DIALOG_OVERRIDE_SCROLLING,

audioFilePath:string,hideDialogBackground:boolean,

endAfterThis:boolean, destroyAfterThis:boolean, noPortraitFadeIn:boolean, noPortraitFadeOut:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

buttonLabelRight:String, buttonLabelLeft:String, yesID:int,

noID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 60: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page60

Step 2e – Dynamic Multiple Button Screen

Thisisthefunctionandargumentstosetupa“MultipleButton”screen:

DialogUI.API_DialogAddMultipleButtonScreen( go:GameObject, dialogID:int, portrait:Texture2D, title:String, dialogText:string, audioFilePath:string,

hideDialogBackground:boolean, endAfterThis:boolean, destroyAfterThis:boolean, noPortraitFadeIn:boolean, noPortraitFadeOut:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

multipleButtons:String[],multipleButtonsID:int[],callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 61: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page61

Step 2f – Dynamic Data Entry Screen

Thisisthefunctionandargumentstosetupa“DataEntry”screen:

DialogUI.API_DialogAddPasswordScreen(

go:GameObject, dialogID:int, portrait:Texture2D, title:string, audioFilePath:string,

hideDialogBackground:boolean, endAfterThis:boolean, destroyAfterThis:boolean, noPortraitFadeIn:boolean, noPortraitFadeOut:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

buttonLabel:String, tokenNameToSet:string, position:DS_DATA_ANCHOR, //e.g.DS_DATA_ANCHOR.Bottom dataFormat:DS_DATA_FORMAT, //e.g.DS_DATA_FORMAT.Text characterLimit:int,

defaultValue:String, nextID:int,

callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 62: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page62

Step 2g – Dynamic Password Screen

Thisisthefunctionandargumentstosetupa“Password”screen:

DialogUI.API_DialogAddPasswordScreen(

go:GameObject, dialogID:int, portrait:Texture2D, title:String, audioFilePath:string,

hideDialogBackground:boolean, endAfterThis:boolean, destroyAfterThis:boolean, noPortraitFadeIn:boolean, noPortraitFadeOut:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

buttonLabel:string, password:string, position:DS_DATA_ANCHOR, //e.g.DS_DATA_ANCHOR.Bottom passwordCaseSensitive:boolean, usePasswordMask:boolean, correctID:int,

wrongID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 63: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page63

Step 2h – Dynamic Title Screen

Thisisthefunctionandargumentstosetupa“Title”screen:

DialogUI.API_DialogAddTitleScreen( go:GameObject, dialogID:int, title:String,

subtitle:string,typewriterOptions:DIALOG_OVERRIDE_YESNO,scrollingOptions:DIALOG_OVERRIDE_SCROLLING,titleScreenPosition:Vector2,subtitleScreenPosition:Vector2,titleColor:Color,subtitleColor:Color,titleAreaSize:Vector2,subtitleAreaSize:Vector,titleFontOverride:Font, //usenullfordefaultsubtitleFontOverride:Font, //usenullfordefaulttitleFontSize:int, //use0fordefaultsubtitleFontSize:int, //use0fordefaulttitleTextAnchor:TextAnchor,subtitleTextAnchor:TextAnchor,

audioFilePath:string, secondsToDisplay:float,

hideNextButton:boolean,hideDialogBackground:boolean,

endAfterThis:boolean, destroyAfterThis:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

buttonLabel:string,nextDialogID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

Page 64: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page64

Step 2i – Dynamic Popup Screen

Thisisthefunctionandargumentstosetupa“Popup”screen:

DialogUI.API_DialogAddPopupScreen(

go:GameObject, dialogID:int, title:String,

dialogText:string,typewriterOptions:DIALOG_OVERRIDE_YESNO,scrollingOptions:DIALOG_OVERRIDE_SCROLLING,popupSize:Vector2, //ThesizeofthePopupWindowbackgroundImage:Texture2D,backgroundAlpha:float,popupOptions:POPUP_OPTIONS,//egPOPUP_OPTIONS.TwoButtons

audioFilePath:string, secondsToDisplay:float,

hideNextButton:boolean,hideDialogBackground:boolean,

endAfterThis:boolean, destroyAfterThis:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,

buttonLabel1:string,buttonLabel2:string,buttonOneNextID:int,buttonTwoNextID:int,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

UsetheseenumsforthePopupOptions:

POPUP_OPTIONS{OneButton,TwoButtons}

Page 65: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page65

Step 2j – Dynamic Icon Grid Screen

CreatinganIconGridviascriptisalittlemorecomplicatedastherearesomanyelementsinvolved.Beforecallingthisfunction,youneedtosetupan“IconGridWindowOptions”objecttohandlethewindow,an“IconGridLayout”objecttohandletheiconlayoutandan“IconGridButtons[]”built-inlisttosetupthebuttonsandnavigation.

Theseclassesaredetailedwithexamplesfollowingthenextfunction.

Thisisthemainfunctionandargumentsneededtosetupan“IconGrid”screen:

DialogUI.API_DialogAddIconGridScreen(

go:GameObject, dialogID:int, title:string,

subtitle:string,typewriterOptions:DIALOG_OVERRIDE_YESNO,windowOptions:IconGridWindowOptions,//Moreinfoonthefollowingpages…iconLayout:IconGridLayout, //Moreinfoonthefollowingpages…buttons:IconGridButtons[], //Moreinfoonthefollowingpages…

audioFilePath:string,hideDialogBackground:boolean,

endAfterThis:boolean, destroyAfterThis:boolean,

screenTransitionIn:DIALOG_OVERRIDE_TRANSITION,screenTransitionOut:DIALOG_OVERRIDE_TRANSITION,callbacksAtStart:UnityEvent,callbacksAtEnd:UnityEvent,callbackAtStart:System.Action,callbackAtEnd:System.Action,navigationCallback:string[]//[gameObjectName,FunctionName,UserString]

);

TocreatetheIconGridWindowOptionsobjectandmodifyitsvalues:

IconGridWindowOptionsigwo=newIconGridWindowOptions();

igwo.IG_WindowSizeX=1474;

igwo.IG_WindowSizeY=1024;

Page 66: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page66

Hereisanoverviewofthe“IconGridWindowOptions“classincludingitsdefaultvalues:

classIconGridWindowOptions{

varIG_WindowSizeX:int=1474; varIG_WindowSizeY:int=1024; varIG_WindowOffsetX:int=0; varIG_WindowOffsetY:int=0; varIG_useXScrolling:boolean=false; varIG_useYScrolling:boolean=false; varIG_WindowShowTitle:boolean=true; varIG_WindowShowSubtitle:boolean=true; varIG_AddSpaceBetweenSubtitleAndContent:boolean=false;titles? varIG_showPanelBG:boolean=true; varIG_BackgroundAlpha:float=1;}

TocreatetheIconGridLayoutobjectandmodifyitsvalues:

IconGridLayoutigl=newIconGridLayout();

igl.IG_iconSizeX=128;

igl.IG_iconSizeY=128;

Hereisanoverviewofthe“IconGridLayout“classincludingitsdefaultvalues:

classIconGridLayout{

varIG_iconSizeX:int=150; varIG_iconSizeY:int=150; varIG_iconsPerRow:int=4; varIG_IconSpacer:int=48; varIG_AddInnerIconSpacing:int=16; varIG_showIconLabels:boolean=true; varIG_iconLabelSize:int=32; varIG_firstIconIsCloseButton:boolean=true; varIG_closeButtonSize:int=100; varIG_showButtonBackgrounds:boolean=true; varIG_buttonAllignment:TextAnchor=TextAnchor.MiddleCenter; varIG_buttonImagePosition:ImagePosition=ImagePosition.ImageOnly;}

Page 67: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page67

TocreatetheIconGridButtonsobjectandmodifyitsvalues:

IconGridButtonsigl=newIconGridButtons();

igl.title=“Button1”;

igl.label=“Label1”;

igl.nextID=2;

Hereisanoverviewofthe“IconGridButtons“classincludingitsdefaultvalues:

classIconGridButtons{

vartitle:string="ButtonTitle"; varlabel:string="Label"; varfailedLabel:string="Unavailable"; //LabeltouseiflogicFailed!

varlogicFailed:boolean=false; //Settotruetocreateadisabledbutton! varbuttonIcon:Texture2D; varnextID:int=0; //NextDialogIDforNavigation //FINALNOTE:Thereareothervaluesinthisclass,buttheyshouldbeignored!}

Page 68: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page68

Google Spreadsheets

Asofversion4.0,theLocalizedDialog&CutscenesframeworkhasagreatnewtooltoimportandupdatedialogsusingonlineGoogleSpreadsheets.LDCisfinallyreadytobeanessentialpartofthedevelopmentpipelineforlargerdevelopmentteamsandcompanies.

Inmanystudios,dialogsaresplitupbetweenthewriterwhocreatestheoriginalstory,theprogrammer(orprogrammers)whobuilditinUnity,andotherwriterswhodealwithlocalization(manuallytranslatingthedialogsindifferentlanguages).Inthisdevelopmentmodel,theGooglespreadsheetworkflowisidealforthefollowingreasons:

- GoogleSpreadsheetsandservicesarefreetouse.- Googleusessecure,fastandreliableserverstohostandprotectyourdata.- Itallowsyoutoshareyourspreadsheetsandgivepermissiontootherson

afile-by-filebasis.Perfectforworkinginteamsoroutsourcingtranslation.- YoursourceisKING.Bydesign,LDCneverchangesanythinginyour

spreadsheets.

Preparing A Spreadsheet For LDC Beforeyoubeginworkingwithspreadsheets,youmustmakesureyouusetheLDCSpreadsheettemplatethathasbeencreatedforyou!Youcanfindthisintheprojecthierarchyhere:TheLDCDemos&Extras/ThirdPartyExtras/GoogleDocs/LDCSpreadsheetTemplate.xlsxDonotmakechangestothisfile.YoumustuploadthespreadsheettoyourGoogledriveandconvertitintoaGooglespreadsheetbeforeitwillbeaccessibletoLDC.

Page 69: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page69

Followthesestepstouploadandconvertthespreadsheet:

1. OpenYourGoogleDriveat:https://docs.google.com2. Uploadthe"LDCSpreadsheetTemplate.xlsx"filetoyourGoogleDriveby

draggingthe"LDCSpreadsheetTemplate.xlsx"filefromyourdesktopintothebrowserwindow.

3. Thespreadsheetwillnowbeavailableinthelist.Clicktheselectionboxnexttothe"LDCSpreadsheetTemplate.xlsx"fileicon.

4. Somebuttonswillappear.Click"More"andthenselect"OpenWith>GoogleSheets".

ThiswillcreateaGoogleDocsversionofthespreadsheet,whichwillbeaccessiblefromtheLDCGoogleSpreadsheetTool.DuplicatethisspreadsheettocreatecopiesthatyoucanusedirectlywithLDC.

Youcanalsodeletetheoriginal(.xlsx)versiononyourGoogledriveifyouwish.

Understanding The Google Spreadsheet

NowthatyouhaveaworkingtemplatetouseandeditinyourGoogledrive,youandyourteamcangettoworkbuildingsomegreatdialogs!

TheGoldenRule

Firstly,thegoldenruleisthatthespreadsheetisconsideredbyLDCtobethekingofthecastle.Inotherwords,thismeansitpresumesthatyouknowwhatyouaredoingandthatbeforeyouimportthespreadsheet,thestructureofitwillremainthesameinthefuture.

Thisdoesn’tmeanyoucan’tmakechangesorfixtypos.TheUpdateactionofthetoolwillallowyoutoupdatethecontentofyourspreadsheetaslongasthereisthesamenumberofdialogscreens.Thisisasafetyprecautiontoprotectyourdata,asitwillnotdeletethingssuchasactionsyousetupinLDC.

PlanAhead

Figureoutwhatyou’redoingbeforeyoustartbuildingthespreadsheets.Yourworkflowmaylooksomethinglikethis:

- Writerpreparesthenarrative/conversationbetweensomeactors,etc.- Yourprogrammerconvertsthisintothefirstdraftofthespreadsheet

usingtheirunderstandingofLDC.Theyimportthespreadsheetusingthetooltomakesureeverythingworkscorrectly.

- Ifthedialogworks,theprogrammer/testergivesittheokandthelocalizationteamaddstherelevantfieldsintothetemplate.

- Theprogrammercheckstomakesurethespreadsheetlooksgood,andusesthetool’s“UpdateDialogFromSpreadsheetaction”toupdatethemissinglocalizations.

Page 70: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page70

Theaboveworkflowworksfineasthestructureofthedialogisneverchanged,andoffersthemostbulletproofworkflowwhichallowsyoutoplaytestearly,andaddmissinglocalizationsorfixtyposatalaterstage.

Working With The Google Spreadsheet

TheGoogleSpreadsheethas35columnsconsistingof5technicaldatacolumns,and30localizedcontentcolumns.Otherthantheheader,eachrowrepresentsanindividualLDCDialogScreen.ThefirstrowiscreateddynamicallyandistheDialogIDthatyouwouldusenormallytoidentifyeachscreenintheinspector.NotesThesecondrowisthe“Notes”column.UsethistoleavenotesaboutanyactionsyouneedtoaddinLDC,orasamessagetoothersinyourteam.DialogTypeThethirdrowisthe“DialogType”.Itoffersaneasytousedropdownmenusoyoucanselectthecorrectdialogstyle.PleasenotethatIconGridsarecurrentlynotsupportedduetothecomplexityoftheoptions.NavigationNavigationisthefourthrow.YouneedtohaveatleastabasicknowledgeofLDCtosetthisupcorrectlyotherwisethetoolwilltryitsbesttoguessforyouduringtheimportstage(andwilllikelythrowsomewarnings).

Page 71: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page71

Forexample,ifyouareusingadialogstylethatonlyhasonenavigationexitsuchasa“Next”screen,youmustsimplytypeasinglenumber.“2”(withoutquotes)wouldbevalid.Ifyouusingascreenthatrequires2buttonssuchasa“YesOrNo”screenora“MultipleButton“screenwith2buttons,youwouldneedtotypeinyourvalueslikethis:“2|3”(withoutquotes)Thevalue2representsyes(firstbutton)and3representsno(thesecondbutton).Weusethe“|”charactertoseparatethevaluesinthespreadsheet.ForMultipleButtonScreensyousetitslengthdynamicallybytheamountofvaluesyousubmit.Forexample,thiswilltellLDCtouse5buttons:“2|3|4|5|6”(withoutquotes)EndDialogUsethedropdownmenutoselectifthisdialogshouldendthethread.Truewillendthedialogafterthisscreen.<Language>Actor/TitleThisisthetextthatwillbeenteredintotheActor/Titlefieldsinyourdialogs(usingtherelevantlanguage).AcoolfeatureistheEnglishActor/TitlenamesarealsolinkedtoanyPortraitsyoumayhavesetupinyourDialogLibrary.Ifthenamesmatchwhatyouwriteinthisfield,theportraitofthesamenamewillautomaticallybeusedduringimport.<Language>TextThisisthetextthatwillbeenteredintothemainbodyoftext(usingtherelevantlanguage).<Language>Button/sThebuttonsfieldinthespreadsheetworksinmuchthesamewayasthenavigationfield.Thenumberofbuttonnamesshouldmatchthenumberofnavigationvalues.Forexample,fora“TwoButton”dialogyoucouldtype:“OK|Cancel”(withoutquotes)Fora“MultipleButton”screendialogyoucoulduse:“ScreenTwo|ScreenThree|ScreenFour|ScreenFive|ScreenSix”(withoutquotes)

Page 72: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page72

Thesameappliesforalllocalizations;theyshouldallhavethesamenumberofvalues.

Importing A Google Spreadsheet From Your Google Drive ToopentheGoogleSpreadsheetimporter,selectthefollowingmenuitem:GameObject>LDC>ImportGoogleSpreadsheetUponclicking“Connect”,awebbrowserwillopenaskingyoutologinandgiveLDCpermissiontoaccessyourspreadsheets.Ifyouagree,youwillbegivenanAccessCodetocopyandpasteintotheboxbelow:

YouwillbeshownalistofyouravailableSpreadsheetsinyourGoogleDrive:

ClicktheSpreadsheetyouwanttoimportfromthelist.ThiswillopentheActionPanel,whichallowsyouto“CreateDialogFromSpreadsheet”,or“UpdateDialogFromSpreadsheet”.Asweareimportingforthefirsttime,wewantto“CreateDialogFromSpreadsheet”.

Page 73: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page73

Weareofferedsomeoptionssuchaswhich“WorksheetIndex”(sheet)toimportfromtheselectedspreadsheet,andwhatweshouldcallthenewGameObject.WecanalsosettheDialogControllertobeanAutoPlayDialogfromtheget-go.

ToimportthespreadsheetasanLDCdialog,wesimplyclick“CreateDialog”andletthetooldotherest!Youarelikelytoseesomemessagesintheconsoleaboutvariousissuesduringtheimport.Mostlythesearefine,butlookoutforLDCMismatchwarnings,astheyshouldbefixedontheSpreadsheetsidetoavoidanyissues(Thisisusuallybecauseafieldhaseithertoomanyvaluesornotenough.Forexample,having5multiplebuttonnamesandonly4navigationexits).Themessagesarequitedescriptiveandshouldhelpyoufindtheerrorquickly.

Updating An Existing Dialog With A Google Spreadsheet Ifyou’vealreadyimportedadialogandhavemadechangestothespreadsheet,youwillbeabletoupdatethechangesusingaveryeasyworkflow!NOTE:Rememberthegoldenrule?Aslongasyouhaven’tchangedthestructureofthedialogyouwillbeabletoupdatethechangesandkeepyourotheradditionsintact.Ifthestructurehaschanged,it’susuallyabetterideatoimportthedialogagaintokeepthingsconsistent.

Page 74: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page74

Forthemostparttheprocessispracticallythesameasimporting.Simplyauthenticateasbeforeandselectyourspreadsheetfromthelist.Thistimewewillselect“UpdateDialogFromSpreadsheet”.Wecanstillchoosewhichworksheetwewanttoimport,butthistimeweneedtodraganLDCdialogintothe“LDCDialogToUpdate”field.

Tocompletetheupdate,wesimplypressthe“UpdateDialog”button.Thetoolwillcarryoutaseriesofchecksandaskyoutoverifythesync.Ifeverythingchecksout,thedialogwillbeupdatedinrealtime!Again,watchoutforwarningsintheconsole.InsomesituationssuchaswhenaDialogIDhasbeenchangedornolongerexiststhesedialogupdateswillbeskippedandleaveyouwithanincompleteupdate.Theconsolewillletyouknowwheretheproblemissoyoucanattempttorectifyit.Asalreadystated,ifthestructurehaschangedtoomuchandyouhaveseenanyofthesemismatchwarningmessages,itsbettertojustimportanewDialogfromscratchandreplacetheoldonecompletely.

Page 75: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page75

The GUI

TheLocalizedDialogs&CutscenesframeworkusesagreatGUIsystemthatisplatformandresolutionindependent!AsofLDCv3.2,thesystemhasanativesizebasedonfullHD(1920x1280)aswellasalegacyoptionbasedontheiPhone4RetinaDisplay(960x640).BothofthesesettingsscaletheUIasneededtofitotherresolutionsdynamically,bridgingthegapbetweenmobile,webanddesktopswithoutanyextrawork!

Alongwithbuilt-inlocalizationfeatures,thissystemisafantasticbasetobuildagreatmulti-platform,multi-languageproject.Thebestthingisit’sfullycustomizableusingUnity’sstandardGUISkins!

Localized GUI Skins DuetothewayFontsworkonmobile(maxtexturesizeof2048restrictsUnicode),thesystemisdesignedtomakeeachGUISkinlocalized.Thisallowsustousesmallersizedfontsperlanguagetogetbetterresultsonmobileandtobegenerallymorememoryefficientacrosstheboard.Graphically,you’llfindthesealltobepracticallyidenticalwithonlyfontsettingsbeingdifferentonsomeofthem.Thisisalsoagreatperformanceandmemoryimprovementonmobile,asyouwillonlyloadthefonts/graphicsyouneed!NotethatyoucanuseasingleGUISkinwithaUnicodefontforalllanguagesifyouprefer!Checkoutthe‘DialogOnGUI’sectionformoreinformationonhowtosetuplocalizedGUISkins.

DialogUI TheDialogUIobjectallowsyoutocontrolhowtheUIisdisplayedtotheuser.Youcanselectslidingtransitionsontheportraitsand/orbuttons,aswellasdefinewhichGUISkinstoload.InthecurrentversionofLDC,manyoftheoptionsregardingGUISkinsinparticularhavebeenmovedtothe‘DialogOnGUI’component.

Page 76: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page76

Designing New GUI Skins

YoucancompletelychangetheappearanceofLDC’sUIusingGUISkins,Unity’sbuilt-insystemforskinningandpositioningUserInterfaces.BelowisanoverviewofthepropertiesthatarebeingusedbyLDC:

Button: UsedforallthebuttonsintheUI.NOTE:Youcannotusethistomovebuttons(asitisusedforbuttontext),use‘ButtonOffset’instead.

ScrollView: UsedforthecontentareaintheIconGridDialogStyles.

Vertical/HorizontalScrollbar: UsedforthebackgroundofthescrollbarsintheIconGrid.

Vertical/HorizontalScrollbarThumb: UsedforthethumbofthescrollbarsintheIconGrid.

CustomStyles/DialogText: Usedforthemaintextofthedialog.NOTE:Use‘ContentOffset’torepositionthetext.

CustomStyles/HeaderText: Theactor’sname/titleinthedialog.NOTE:Use‘ContentOffset’torepositionthetext.

CustomStyles/BackgroundBox: Fordialogbackgroundimages.NOTE:Originalsizeofthebackgroundboxis960x160(or1920x320forHDskins).

CustomStyles/PanelBox: Inthe“MultipleButton”screens,thisboxisdrawnbehindthebuttonsandontopofthemainBackgroundbox.NOTE:The“ButtonOffset”stylebelowalsorepositionsthisautomatically.

CustomStyles/PanelHeaderText: Thetitletextusedinthe“MultipleButton”stylescreens.NOTE:The“ButtonOffset”stylebelowalsorepositionsthisautomatically.

CustomStyles/DataEntryTextField: TheeditboxinDataEntryscreens.

CustomStyles/ActorPortrait: ForscalingandpositioningPortraitsNOTE:Use‘FixedHeight/Width’tochangetheportrait’ssizeand‘ContentOffset’forrepositioning.

CustomStyles/TitleStyleSubtitles: Usedforsubtitlesin“Title”styles.

CustomStyles/TitleStyleTitles: Usedforthemaintextin“Title”styles.

Page 77: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page77

CustomStyles/ButtonOffset: Forrepositioningbuttons.NOTE:Use‘ContentOffset’torepositionbuttonsandPanelboxes.

CustomStyles/Windows: Backgroundwindowofthe“Popup”and“IconGrid”styles.

CustomStyles/PopupTitle: Titletextof“Popup”styles.

CustomStyles/PopupText: Dialogtextof“Popup”styles.

CustomStyles/IconGridTitle: Titletextof“IconGrid”styles.

CustomStyles/IconGridSubtitle: Subtitletextof“IconGrid”styles.

CustomStyles/IconGridButtonLabel: ButtonLabelsof“IconGrid”styles.

Page 78: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page78

Dialog On GUI The‘DialogOnGUI’componentisthecoreGUIsystemusedbyLDC.ItcanbefoundontheDialogUIGameObject(orwillbecreateddynamicallyifanotherGUIabstractionlayerdoesn’texist).‘DialogOnGUI’worksontopofUnity’s‘OnGUI’SystembutextendsitwithpowerfulfeaturesthatallowyoutocustomizehowtheGUIisscaledacrossdifferentdevices,resolutionsandlanguages.

Rendering

GUI Rendering TheGUIRenderingtaballowsyoutorendertheLDCGUIdirectlytotheScreenortoaMaterial(tobeusedinWorldSpaceGUIsetupssuchasVR).Thefollowingoptionsareavailable:

Screen

RenderingtotheScreenisthestandardGUImethodusedbyLDC.Itisthemostcompatiblesolution(withtheexceptionofVR)andofferstheeasiestUIimplementation.Itshouldalsorunslightlyfasterduetothefactitisbeingrendereddirectlytothescreen.

Material

RenderingtoamaterialallowsLDCtodrawtheGUIintoitsownRenderTextureandsendittoaMaterialyouchoose.ThisallowsyoutosetupaWorldSpaceGUI(seethe“SettingUpAWorldSpaceGUI”chapterformoreinformation)whichisprimarilyusefulforplatformssuchasVR.RenderingtheGUItoamaterialopensthepossibilityforaddingshadereffectsandrotating,scalingandpositioningtheUIjustlikeanyother3Dobject.

Page 79: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page79

GUI Scaling TheGUIScalingtaballowsyoutoselectoneofthreedifferentscalingmethodstorenderLDC’sGUI:

StretchToFill

'StretchToFill'istheoriginalscalingsystemofLDC.Itstretchesthescreentofitonanydeviceandresolution.Thisisthemostcompatiblescalingmodeandwillguaranteeeverythingyouhavesetupisvisibleandoccupiestheentirescreenspace.Asmalldrawbackistheaspectratioisn'talwaysperfect.

ScaleToFit

'ScaleToFit'isanewscalingmodethatwillshrinkorgrowtheUIinordertofitthecurrentscreenandpreservetheaspectratioatthesametime.Thiscanleaveemptyspacearoundsomeoftheedgesofthescreensothe'Anchor'settingcanbeusedtopositiontheUIinthisspace.The'Bottom'anchorisusuallyagoodchoiceforthis.The'BackgroundWidener'isaspecialoptionthatcanwidenthewidthofyourskin'sbackgroundimage(settingthisto1orlowerwilldisablethisfunctionality,whileincreasingthenumberwillincreasethewidthoftheimage).

OverScale

'OverScale'isascalingmodethatgrowstheUItocoverthescreenandmaintainitsaspectratio.Itissimilartothe'ScaleToFit'methodexceptthatitwillclipitselfinordertocoverthescreen.Itisanchoredtothebottomrighttomakesuredialogbuttonsarevisible.Becauseofthis,thismodeisrecommendedonlyforusersneedingsimpledialogscreensthatpreferadifferentapproachtounusualwidescreenresolutions(suchasonAndroiddevices).

Skins HD / Skins SD

LDCgivesyoutheoptionofusinglowerresolutiongraphicsandfonts(whichisparticularlyusefulforoptimizingmobilebuilds)intheformofGUISkins.TheSkins(HD)andSkins(SD)tabsallowyoutoorganizetheseGUISkinsbyquality(HighDefinitionvsStandardDefinition)aswellasbylanguage.

Page 80: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page80

ThisallowsyoutosetupGUISkincollectionstargetedforparticularlanguagesanddevicequality,whichmeansnounnecessaryfontsorgraphicsareloadedintoyourgameatruntime.ThebenefitisbetterperformanceandlessRAMisusedmakingyourprojectstreamlinedandoptimized!

ToaddapathtoyourcustomGUISkin,youneedtomakesureitislocatedwithinafoldercalled“Resources”.FromwithintheResourcesfolder,yousimplyaddtheappropriatefilepathintoeachofthelanguageslots.

Thedefaultskinsareloadedatruntime.Forexample,theEnglishHDskinloadsfromhere(notethat“Resources”shouldnotbewritteninthefilepath):Resources/UIHD/DialogSkinHD–English

TIP1:ItisadvisedtoduplicatethedefaultGUISkinsfolderandupdatethe“LocalizedSkin”groupintheDialogUIsoyoucankeeptheoriginalskinsunchangedforreference.

TIP2:IfyouareonlyusingEnglishinyourproject,youdonotneedtoaddthereferencestotheotherlanguages–don’tforgettoturnofftheotherlocalizationsyouarenotusinginthe‘DialogLocalization’componentfoundontheDialogUIGameObjectotherwiseyoumayrunintoerrors!

HD Options

The‘Options’tabinthe‘DialogOnGUI’componentallowsyoutotoggleHDskinsonaperplatformbasis.ThisensuresthatthecorrectGUISkinisloadedonaspecificplatformwithnocodingonyourpartwhatsoever!

Youcanalsoclick“AlwaysUseHDSkins”whichwillmakeLDCusetheHDGUISkinsoneveryplatform.Otherwise,everythingthatisnotcheckedwillusethestandarddefinitionGUISkinsbydefault.

TheGUIDepthvalueallowsyoutoselectwhichlayerUnitydrawstheGUIto.ThisallowsyoutobalanceyourownGUI’swithLDCandmakesureeverythingisgettingdrawn(andlayered)inthecorrectorder.

TheuGUICameraslotallowsyoutodraginacamerabeingusedforuGUIelements(wheretheCanvasissetto‘ScreenSpace–Camera’).ThiswillmakesurethattheuGUICameraisrenderedabovetheLDCGUIlayer.

Page 81: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page81

Setting Up A World Space GUI AsofLDCv6,itispossibletosetupyourGUItobeinworldspace(ratherthanscreenspace),thisisnecessaryforVRbutalsoallowsyoutosetupamorecustomUIfortraditionalplatformstoo.

How To Setup A Basic World-Space GUI FollowthesestepstosetupaWorldSpaceGUI:

1. MakesureyouhaveaDialogUIGameObjectsetupinthescene.

2. IntheDialogOnGUIRenderingtab,setthe“RenderTo:”dropdowntothe“Material”setting.Itisrecommendedtousethedefault“LDCGUIWorldSpace”material.

3. Underthe“GUIScaling”sectionintheDialogOnGUIcomponent,use“StretchToFill”asthatwillpreservemorepixelsinworldspace.

4. Fromhere,youcanusethemenushortcutstocreatetheworldspaceGUIobjectusingoneofthefollowingmenuoptions:

GameObject>LDC>WorldSpace>CreateWorldSpaceGUI(Quad)GameObject>LDC>WorldSpace>CreateWorldSpaceGUI(CurvedMesh)

NOTE:InregardtotheWorldSpaceGUIobjects,it’sworthmentioningthataQuadisasimpleflatmeshthatdisplaystheUIin3Dspace.TheCurvedMeshusesacurvedplanewhichaddsmoredepth.Youmayalsoexperimentbyusingcustommeshesifyouprefer.AslongastheUVsarecorrect,itislikelytowork!

YoushouldnowhaveaworkingGUIsetupthatusesthemouseasinput.Youcanmove,rotateandscaletheGUIaswellasmakeyourownshadersfortheUIMaterial.

FormoreinformationonsettinguptheDialogWorldSpaceGUI(includingadditionalinformationaboutsettingupthesystemspecificallyforVR),continueontothe“DialogWorldSpaceGUI”chapter.

Page 82: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page82

Dialog World Space GUI The‘DialogWorldSpaceGUI’componentisusedtodisplayandhandletheinputoftheLDCGUIinworldspace,overridingsomeoftheoptionsoftheDialogUIcomponent.Itisdividedintothe“Input”,“Raycasting”and“Options”tabs.TheInputtaballowsyoutosetuphowyouwillinteractwiththeWorldSpaceGUI.ThefollowingInputmodescanbeselected:

Disabled Input

ThedisabledinputmodeblocksallinteractionstotheLDCGUIsoitcanonlybeviewedandnotinteractedwith.

Mouse Input

TheMouseinputmodeallowsyoutointeractwiththeWorldSpaceGUIusingthemouse(andtheusualLDCkeyboardshortcuts).Thefollowingoptionsareavailable:ScrollWheelSensitivity

Booststhesensitivityofthemouse’sscrollwheel(usedprimarilyforscrollingthroughIconGrids,etc.).

Page 83: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page83

Transform Input

TheTransforminputmodeallowsyoutointeractwiththeWorldSpaceGUIusingaTransformfromthecurrentscenetosimulateamousepointer.ThisisworksspecificallywellforVRastheTransformshouldusuallybeoneoftheplayer’shands.PointerTransform

ThisistheTransformthatwillbeusedasthesimulatedmousepointer.InVR,thisshouldbetheplayer’shand(orachildobjectoftheplayer’shand).WhatShouldTriggerLDCButtons?

WhichKeyCodeshouldbeusedtodetectwhenaplayerwantstointeractwiththeLDCGUI?Bydefault,“JoystickButton0”ischosen(whichshouldbindtotheOculus“One”Button).ScrollingMode

ThereareseveralscrollingmodesforthisinputmodewhichallowstheplayertoscrollthroughIconGrids.TheOptionsare:NoScrolling: Scrollingisdisabled.ScrollWithInputAxes: Youcansetupthenamesofahorizontalandverticalinputaxis(configuredinUnity’sInputmanager)tocontrolwhichbuttonscontrolscrolling.Theseaxescanbereversedbyusingthe“InvertInput”checkboxes.Finally,the“ScrollingSensitivity”valueallowsyoutocontrolhowthefast/slowthescrollingis.ScrollWithInputAxes: Youcansetuptheindividualkeycodesthatcontrolscrollingforeachdirection.Finally,the“ScrollingSensitivity”valueallowsyoutocontrolhowthefast/slowthescrollingis.

Page 84: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page84

Raycasting

TheRaycastingtabhandlesthedetectionofinputbyusingraycaststosimulateworldspacebacktoscreenspace.Thefollowingoptionsareavailable:

RaycastDistance

Howfarwillweallowtheraycastdistancetogo?

IgnoreCollisions

Raycastingwillignoreallotherobjects(whichignoresLayerMasksandTags).Disablethisifyouwantyourraycaststotakeotherobjects/collidersintoaccount.Thisisenabledbydefault

RaycastLayerMask

Theraycastwillonlycollidewithlayerscontainedinthemask(youshouldmakesurethatthelayerofyourGUIobjectisoneofthem!).

RaycastTag

TheraycastwillonlycollidewithobjectsthatusethesuppliedTag(youshouldmakesurethatthetagofyourGUIobjectmatches!).Ifthisisblank,tagswillbeignored.

Page 85: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page85

Options

Theoptionstaballowsyoutocustomizesomemiscellaneousitems.Thefollowingoptionsareavailable:

CacheCamera

YoucanmanuallyaddthemaincamerainyourscenetotheCameraslotinordertooptimizethecode.Ifyouhaveamaincamerathatchanges,leavethisblankfordynamiclookups.

UseLargeScreenKeyboardForDataEntry/PasswordScreens

WhenenteringdatausingtheDataEntryorPasswordDialogStyles,abasicfullscreenkeyboardwillalsobedisplayedtofacilitatedataentry.ThisishighlyrecommendedwhenusingtheTransformInputmode(VR)asakeyboardisnotavailableonthoseplatforms.

DebugMode

Enablethischeckboxtoseedebuglinesinthesceneviewandmessagesintheconsoleinregardtoray-casting.Thiswillhelpyoudebugissueswhilesettingupyourraycastlayers,tags,etc.

Page 86: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page86

Dialog World Space Line Renderer

IfyouareusingtheTransformInputmode,anoptionalscriptcalledthe“DialogWorldSpaceLineRenderer”isavailabletohelpyoumakeVRbeamstoshowtheuserwheretheyarepointing.

NOTE:Anexampleofthisfullysetupcanbefoundinthe“LDCWorldSpaceVRDemo”scenefoundintheWorldSpacedemos.

ThiscomponentrequiresaLineRenderercomponenttorenderthepointerbeam.Youcanoptionallyaddanotherobject’sRenderertothe“HitPointRenderer”fieldwhichwillpositionitwhereitintersectswithacollider.Usingthisscript,youcancreateresultslikethis:

Intheexampleabove,thestraightredbeamisrenderedbytheLineRendererandthesmallredsphereattheendofthebeamisthe“HitPointRenderer”,showingwheretheinteractionhascollided.

ThecomponentautomaticallyhidestherenderersifyouarenotusingtheTransformInputmodeorthereisnoLDCdialogplaying.

Page 87: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page87

World Space GUI Considerations ThereareseveralthingstoconsiderwhenusingLDC’sWorldSpaceGUI:

MouseInput

MouseInputissimulatedinworldspaceandconvertedbacktothestandardUIsystem.Almosteverythingwillworknormallyexceptforsecondaryinteractions.Forexample,clickingcorebuttonswillworknormallybutthingslikedraggingscrollbarswillnotwork.However,themouse’sscrollwheelwillworkforverticalmovementofIconGrids.TheMouseInputmodeisalsocompatiblewithLDC’susualkeyboardshortcutstoo.

TransformInput

WhenusingTransformInput(forVR),LDC’skeyboardshortcutsaredisabledtoavoidconflicts.AswiththeMouseInput,secondaryinteractionsarealsonotpossible,limitingauser’sinteractionstocorebuttonsandscrollingthroughicongrids.Ideally,IconGridsshouldbedesignednottohaveanyscrollingatallinorderforVRinteractionstobeaspainlessfortheuseraspossible(literallypointandhitasinglebutton).Ifscrollingisabsolutelyrequired,itcanbesetupwithcustomkeycodes/axes.

Performance

ThereareperformanceandmemoryimplicationswhenusingaWorldSpaceGUI.Forthisreason,WorldSpacesetupsarerecommendedmainlyfordesktopandVRplatforms.

AspectRatio

YoumaynoticethattheWorldSpaceGUI’sareoftenscaledto1.92x1.28x1.ThistomatchupwiththecoreLDCresolutionwhichisbasedon1920x1280.Eventhoughthisisarecommendedsetup,itisnotarequirement.

Conclusions

YoushouldkeeptheselimitationsinmindwhiledesigningyourDialogScreens.Trytoavoidcreatingcontentthatrequiresscrollingtomakeitaseasyaspossiblefortheusertointeractwithitacrossplatforms.

ThereareoptionsforusingcustomkeyCodes/axesforscrollinginVRifnecessarybutifyouareusingthemouse,donotcreateicongridsthatrequirehorizontalscrolling(sticktoverticalscrollingonly).

Page 88: LOCALIZED DIALOGS & CUTSCENES - For Unity....Localized Dialog System for Unity – Page 5 Version History V6.1 - Updated for Unity 2019.3 V6.0.1 - Next IDs are automatically populated

LocalizedDialogSystemforUnity–Page88

Support

Ifyouneedanyassistanceorhavesuggestionsforthisplugin,feelfreetovisittheLDCwebsiteat:

www.unitygamesdevelopment.co.uk

Ihopeyoufindthissystemuseful,asIhaveinmyownpersonalprojects!=)

Allthebest!

-Mel

FinalNotes

AllfontsandmanyimagesfoundintheDemosfolderofthispackagedonotbelongtomeandwerefoundonlineatvariousfreewarewebsites.Ifyouarelaunchingacommercialproject,youshouldverifyyouareusingfontsandassetsthatarefullylicensed.Thispackagedoesnotcoverthelicensesforthesefontsorimagesastheyarefordemonstrationuseonly.


Recommended