Transcript for:
Creating a 3D Adventure Game in Unity

hi I'm Chris and in this tutorial we're going to be covering how to create a 3D Adventure game using unity 2021.3 and Adventure Creator version 1.75.5 give you a quick snippet of the kind of game we're going to be making you can see we've got a third person game where we've got timpot the character from the 3D demo walking around this this evil layer set and brain is haplessly tied up to this laser table so we're going to have a little puzzle where we try to rescue him Adventure Creator is available to purchase on unity's asset store and after doing so we can import it from inside Unity by going to window package manager and after choosing packages my assets we can filter down to Adventure Creator and then choose import to bring the package into our project for this tutorial we're going to be using some special tutorial assets so we're not going to need either of the two demo games so in this import Unity package window I'm going to uncheck the 2D demo and demo folders although you can import them if you wish and once it's imported we'll get this installation box just telling us about a couple of inputs and layers that it wants to add to our project settings it can do this All automatically so I'll just choose ok and then when it's finished I can close the package manager and we've got Adventure Creator up in the top toolbar here again we're going to be using some specially made assets for this tutorial and we can get them from this top toolbar by going to Adventure creator online resources and then downloads that'll bring us to the downloads page of the main Adventure Creator website and near the top here we have this tutorial assets files link which we can click to download you can also click on this alternative link to give you a urp ready version of these tutorial files back inside Unity we can go to assets import package and then custom package locate the tutorial files to bring up the import package window for this and I'll just import everything like so we can then find this tutorial files folder inside our project window if I then click on the evil layer subfolder and then click on the scene of the same name we've got this evil layer scene complete with lighting and materials and a few props that we're going to want to make interactive the first step in creating an adventure Creator game is make a set of managers that could be used to control that game's settings we can do this by going to the top toolbar and choosing Adventure Creator getting started new game Wizard this will bring up a new window that we can use to give our game some initial settings so on the first page I can give a game name of my 3D game choosing next again will set a camera perspective of 3D and underneath we can choose a means of moving the player character I'm going to choose direct which involves moving the player around either with keyboard keys or with the controller next we'll choose our interface we'll go over all of these in detail later but for now I'll just choose context sensitive because it's the most simple next again we'll have the GUI system set to default Unity UI and this means that we'll be provided with a default interface so that we can access the inventory the pause menu and so on and we're going to use Unity UI to do that we'll then get a final page just to confirm all of our choices we can change many of these settings later on so it doesn't matter too much and I'll choose finish and after a moment it's finished creating our manager assets would be asked if we want to organize the scene I'm going to choose no just so that we can have a look at what we've actually made here if I close the new game Wizard we can see down in our project folder we've now got a folder of the game name that we entered and inside we have a UI folder that has all of the UI prefabs that make up our interface and a managers folder that has all of the manager asset files and these manager asset files are assigned here in this AC Game editor window I'm going to dock this just beside my inspector and you can see we have eight tabs one for each manager and each of these managers relates to a different aspect of our game so for example all of our inventory items are stored in the inventory manager and all of our settings are here in the settings manager these asset files are necessary for our game and if they ever become on set for example when importing an update to Adventure Creator we can bring them back just by double clicking the manager package file that's just inside the my 3D game folder and that'll just reassign all of these asset files in our game editor before we go any further I'm just going to go to file save as and then make a new copy of this evil layer scene inside our my 3D game folder and I'll add this new scene to our build settings by going to file build settings and add this open scene so this evil last scene is pretty Bare Bones we don't even have a camera so if we go to the game tab it'll say No cameras rendering and the first thing we'll want to do is convert this into an adventure Creator scene we can do that by going to the AC game editor's scene manager and then we'll get this option to organize the scene either with or without folders folders are really just empty game objects to help us keep things organized and you can see here after clicking that we've now got a bunch of empty game objects for things like lights and sounds NPCs and so on I'll select my three lights and put them into the lights folder and I'll take the three props and put them into set geometry inside the cameras folder we have a main camera and what I'll do is just uh move the view in the scene manager up to the top here so we get a good overview of the main floor space here and go to game object align with View and that'll just mean that we have a default camera looking over everything you can see our hierarchy also has a game engine object and this is necessary for adventure Creator to run if we run the scene you'll see that we have the default interface that we opted for if we move the mouse to the top of the window we've got the inventory menu and we can click on the lower left here to open up the default pause menu but since we're making a 3D third person game we're going to need a player character to control we can find the graphics for such a player inside our tutorial files folder and then evil layer tin pot and El underscore tin pot is a model that we can drag into the scene and you can see it's the same character if you've played the 3D demo at the moment he's just an animator and a skinned mesh renderer and we're going to convert him to a character using Adventure creators character wizard we can do that from the top toolbar and choosing Adventure Creator editors character wizard and like before it's just a case of going through each page and filling in the details so we're going to be making a player and we can give this player a name so I'll choose a tin pot next we assign a game object that forms the basis of his graphics so we'll assign this El tin pot object that's in our scene next we choose an animation engine or how the character is going to be animated Adventure Creator will try to Auto detect this and it's suggesting the use of mechanim which is the standard option for 3D characters clicking finish and we can close this window and you can see we've now got a few components added to this character so let's run the scene now and see what happens and you can see straight away he's falling straight through the floor and that's because he is physics based he is using a rigid body and a capsule Collider and what we'll need to do is add a collider to the set here so if I select the keep clicking to get the platform object and I'll get the the steps here as well and in their inspectors go to add component and choose mesh Collider and this platform object covers the walls as well I also want to make it so that he can't clip through some of these props so for example we've got this laser button I'll add a mesh collider to that as well maybe check convex for that and do the same for this laser table a few more let's say we've got this bin in fact there's another bin over here we've also got this cupboard here that should probably have a box Collider and in the corner of the room we've got this sofa and coffee table so for the coffee table I'll add a mesh Collider checking convex and I'll give the sofa a mesh collider as well finally in the other side of the room we have these lift doors and the lift doors are actually both one single mesh and inside the lift parent we have the skin to mesh renderer for it and I'll add a box collider for this as well if we now run the scene we'll find that we've got our player is now on the ground properly and I can use the cursor keys or the wasd keys on the keyboard to move them around be able to use these keys because we're using Direct Control and this is assigned in our settings manager underneath interface settings if at this stage you find that your own player character isn't moving the first thing to check is your player character's animator component and make sure that apply root motion is not checked this is because when this option is checked Adventure Creator will assume that all of the character's movement is driven through root motion and so your animator will need to be configured with such animations right now this is the only way a character can move and so if we want to be able to move characters during cut scenes and this involves using pathfinding we're going to have to bake a nav mesh if I select the evil layer root object to get all of the objects that make up the scene I'll go to static in its inspector and check navigation static I'll choose yes change children and then if we go to the navigation tab we can get there by going to window AI navigation selecting the bake Tab and then click bake you'll see that we now have this this blue nav mesh around the scene showing all the places that the character can move to want to test this out the easiest way to do this is using point and click pathfinding and for that we just need one more step and that's to place the clickable area of the scene onto the nav mesh layer so if I click on the platform game object go back to the inspector and set the layer to navmesh we'll now be able to use point-and-click pathfinding we can enable this again going back to the settings manager set the movement method to point and click and if we now rerun the scene we can click the mouse to have our character move around options in the settings manager can all be changed through scripting at runtime so you could for example switch to direct for some sequences and point-and-click for others let's take a closer look at our player object now again he's relying on a rigid body and capsule Collider if you prefer these can be removed and replaced with a character controller just raising up the center y21 so that the bottom is by his feet as for animation we have a few animations inside his model file if I go to Evil layer tin pot and expand his model file you can see we've got a few animations here for walking running and so on and a few cutscene animations as well let's just focus on the movement animations for the moment and in order to make use of these we're going to need an animator controller so I'll go to my 3D game folder create a new folder named player right click create a new animator controller again name this player double click and I'm going to have idle Walk and Run be part of a blend tree so I'll right click inside this choose create state from New blend tree double click on that and then create three new motion fields the first of which will be robot idle then robot walk and robot run Unity has automatically created a float parameter named blend that can be used to drive these animations and what we want to do is tell Adventure Creator to control this value if we go back to his player inspector you can see he's got a list of mechanim parameter Fields with default values and these all relate to parameters in the animator that Adventure Creator is allowed to control at the top we have a move speed flipped parameter by default named speed so if we rename blend to speed then Adventure Creator will take control of this parameter at runtime we just need to assign his animator controller as the one we've just made so I'll click beside the controller field and set it to player running the game you can see now if we click to have him move he's playing actually his run animation and this is just because we need to tweak the threshold values a little bit if we look a little further down in the player component you can see his walk speed is set to 2 and his run speed to 6. so we just need to update his animator to use these threshold values instead going back to his animator I'll go to the blend tree uncheck automate thresholds set the Run threshold to 6 and the walk threshold to two and if we test this in game you can see that it plays a little bit more naturally we can double click to have him run and just single click to have him walk coming out of play mode and going back to his animator's base layer we'll add one more animation and that's robot talk I'll drag this into the window and we're going to drive this animation's playback using another parameter this time a Boolean so I'll click add on the left here choose Bull and name it is talking I'll right click on the blend tree choose make transition to robot talk inside this I'll uncheck has exit time and give it a condition of is talking is equal to true and I'll do the opposite for the reverse again if we want Adventure Creator to automatically take control of this we'll need to make sure that it's listed in his player component so if we go and find that you can see he's got a talk ball and it's already set by default two is talking we don't yet have any speech to actually test this out with but when we do this animation will kick in automatically returning to the settings manager I'll set the movement method back to direct as for where the player Begins the scene from we want to have him start over by the lift doors here and this is a case of adjusting the default player start if we go to the scene manager you can see underneath scene settings we have a field for our default player start and if I click on it we can see it in the hierarchy and zooming in you can see it's represented by this blue arrow so I'm going to zoom out a little bit move it over to the lift doors and rotate it so that it's facing away from them finally I'll make our player character a prefab by dragging it into our player folder as an original prefab we can now delete him from the scene and then go to the settings manager underneath character settings we have a player prefab field so if I assign this prefab asset file into that slot he'll be spawned in automatically at runtime and this just avoids the need to place a player in each of our scene files at the moment our scene only has a single camera with no movement so the player is able to move down to the bottom here and we can no longer see what's going on adventure Creator's camera system is quite similar to cinemachine if you're familiar with it in that we use a single main camera that performs all of the rendering and a series of game cameras that are used for reference points on the topic of cinemachine Adventure Creator does support it and an integration package can be found over on the downloads page just as before we can reach this by going to the top toolbar and choosing Adventure creator online resources and then downloads for this tutorial though we're just going to be sticking to a c and if we go to the scene manager we can see just underneath our default player start field we have one for default camera and this is currently unassigned so I can click on the create button beside it to automatically create and assign this game camera called navcam1 for this default camera we're going to have it kind of tracking horizontally along the x-axis as the player moves along so I'll bring it up like so and in its inspector we'll have a look at its game camera component in the x-axis movement panel I'll uncheck lock and you'll see we get a few more Fields here but I'm going to leave these alone until we're in play mode going further down I do want the camera to be looking at the player all the time so I'm going to uncheck the lock in spin rotation and set the affected by to look at Target and the target is going to be our player and you can see down at the bottom this is automatic we've got Target is player checked so what I'll do now is run the scene and then tweak these values as we go so you can see we're now running the game with navcam1 as active and I want it to be a little bit closer to the player so I'll start by increasing the offset in the x-axis movement panel and you can see if we move a little bit too far to the left our camera then Clips through the wall so what we're going to need to do is check constrain and then set some minimum and maximum values I'll lower the minimum constraint to just about the point where it goes through the wall and then make sure that the maximum constraint is high enough as well finding the right values for these fields is very often a case of playing with them in play mode and having found some values that work for this I'm going to go to the top right here and choose copy component then come out of play mode and paste those back in by choosing paste component values moving around the scene is also a little bit slow so I'm going to add the ability to have the player run if we go to the game editor's settings manager you can see about halfway down we have this available inputs box and this lists all of the inputs that we can Define that will have an effect on our game you can see we have a run input that can be either a button or an axis and this means that if we Define an input name to run we'll be able to use that to move the player more quickly let's do that by going to edit project settings choosing input manager I'll increase the axes by one name it run and give it a positive button of left shift closing that and testing it out I can then hold down the shift button actually it moves very quickly I can hold down the shift button to have him move around so I think I'll make this a little bit slower coming out of play mode I'll reselect the prefab and you can see our run speed scale is set to six so I'll change this to four and I'll also update his animator controller and update his blender tree to transition to the Run animation with a value of 4 as well now you can see when we get to the other side of this room here we have a coffee table and a seat as part of the puzzle we'll be making we're going to have some interactivity over here and we're going to need to be able to see things more clearly when the player is over here we can do this with a second game camera and then transition to it as the player walks into this area we can create a new game camera by going to the AC game editor's scene manager you'll see that we have a list of prefabs that we can add to the scene by clicking so I'll create a new game camera and I'll name this nav cam 2. and I'll move it over to the other room here we want this camera to take effect as the player approaches this area and we can do that using a trigger back in the scene manager underneath the logic panel I can create a new trigger and you can see as we do all this adventure Creator is placing these objects in the correct hierarchy folder so I've got my trigger and I'll name this trigger nav cams and I'll move it over to the other side of the room if I zoom in a little bit you can see it's represented by this Red Cube and this represents the bounding area for which the trigger takes effect we're going to make it so that navcam 2 becomes active when we enter this trigger and we switch back to navcam1 when we exit so I'll use the scaling Gizmo to just increase its size like this and have it just cover this portion of this scene going to the inspector you can see that we've got this trigger component which starts off with a properties panel it's going to be detecting the player entering the trigger and it'll only be running during gameplay underneath we have this little panel saying engine weight and this refers to our game's default action and action lists are Adventure creators visual scripting system that allow us to chain up logic without having to do any coding to change the camera we're going to use a different action type so I'll change the category from engine to camera and then the sub category from Crossfade to switch you can see that the fields underneath have been changed to represent this new action type and so we've got this new camera field the new camera is going to be navcam 2. and if we want we can set a transition time let's say maybe two seconds and now let's see what effect this has made so as we move over to this part of the scene here we switch over to navcam 2 and we want to make it so that we can switch back to navcam one when we leave to do that we're going to make use of another trigger component now we could do that by using the scene manager to create one more but we want its boundary to be the same as this one we've already made so what I'm going to do is instead just add another component to this same object if I click on ADD component and then find the adventure Creator category logic I'll click on trigger and this time we're going to set the trigger type to on exit and just like before we'll use a camera switch action to switch back to navcam1 with the transition time of two seconds we'll make these transitions a little bit smoother and you can also see that when the switch occurs this menu button down here flickers off for a moment and that's because this menu is set up to only show during gameplay and these actions cause our game to temporarily enter a cutscene we can change that by setting the when running Fields both to run in background and I'll set the movement method to smooth to have things feel a little bit more natural now that we have a player character we can move around the scene and have the camera follow him let's add some interactivity so that we can start to build up the puzzle that is going to make up our little game starting with the chair by the window we can make any portion of the scene interactive by adding a hotspot going back to the scene manager underneath the logic panel we can find a hotspot type and if I click on that we'll then get the option to position over the selected mesh so if I click on that and with the chair selected I'll choose add new and we can see we've now got this yellow Cube surrounding it this hotspot has been placed in my hotspots folder here as well I'll go to the inspector and name it hotspot share and you can see the clickable area is represented by this box collider and we have a few properties for the hotspot itself we'll go over some of these a little later on but for now I'm just going to keep things simple and have the player give a response when we click on it we can do that by going to the use interactions panel and click on the plus icon beside it you can see we've got a few more Fields here but the one we want to pay attention to is the interaction field at the moment this is set to none and we can change that by clicking create to automatically create and assign this use interaction object if we have a look at the inspector for this it looks very similar to the trigger we made earlier in that it's made up of actions that are used by Adventure creators visual scripting system we can continue to work here in the inspector but I personally prefer to rely on the action list editor which is a dedicated node editing tool we can access it either by clicking on action list editor or by clicking the node icon in the hierarchy our default action is engine weight so I'm going to change this to a dialog play speech action so that we can have our player say something I'm going to check player line and then set the line text to something like nice chair too bad I don't have a butt going back to the chair hotspot you can see underneath the interaction field we have one for player action and this just determines what the player does before running our action list we can set this to turn to face just to have the player character face the object before he says anything at runtime when we hover over the chair you can see the name of the game object is now showing up and it's showing us hotspot chair and we can correct this either by renaming the object itself or by overriding it with the label if not name field so I'll do that typing in chair hovering over now we now get the correct name and if we click on it you can see the player turns and you can see the speech text is appearing in our subtitles let's do something similar now for the giant laser gun here again we'll go to the scene manager only this time we don't get an option to position it over the selected mesh and that's because we're currently dealing with a skinned mesh renderer instead I'll just create a new hotspot as normal naming it hotspot laser and you can see it's defaulted to the center of the scene so I'll have to move the hotspot over to where the laser is we can rotate and stretch out the object so that the collider fits the laser a little bit better but rather than using a box glider we'll probably want to use something like a capsule collider instead I can just remove the Box collider component and add a capsule collider instead stretched out maybe a little bit more and then as before we can go back to our hotspot component so I'm going to enter in a label if not name as laser and I'll create a new use interaction with it an interaction action list and inside this action list will have another dialogue play speech in which we have the player say something seems dangerous I'd better not get too close this time we'll have the player move a little bit closer to the laser before running this action list and we can do that by setting the player action to walk to and I'll check face after moving as well the main puzzle of this game is going to revolve all around turning this laser off and when we do we're going to animate the laser so that it rotates downward and that's going to happen from the laser guns pointer pivot we might want the laser to still be clickable at that point so rather than having the hotspot never move I'm just going to parent this hot spot to the pointer object in the hierarchy of the laser guns skeleton now that we have some hot spots in the scene that we can interact with it will be nice to have a bit of feedback from our player character and have him turn his head to face them as we hover over them if we go to the settings manager and scroll down all the way to HotSpot settings we can check player turns head to active hotspot and we then just need to have our player configured to be able to do that if we find our El Tin part player prefab and double click on them you can see underneath mechanim settings we have an option for use ik for head turning and this would then just need our player's animator to have ik enabled on his base layer unfortunately we can't make use of this for this particular character and that's because he's not a humanoid if we go to the tutorial files evil layer tin pot and then have a look at the model file going to the rig tab you can see that his animation tab is set to generic and that's necessary because he doesn't have legs or feet in the case of tin pop we're going to have to be a little bit more complicated and instead use a 2d blend tree to control the head turning you can see up in the mechanism parameters panel we've got a couple of float parameters for head your and head pitch so I'll go and Define those now and then we can go and create those same parameters in our player controller so that this doesn't interfere with any other animations I'm going to use a sub layer so I'll go to my layers panel click new and name it head I'll increase the weight to 1 and set the blending to additive inside I'll create a new blend tree I'll set the blend type to 2D simple directional and the parameters are going to be head yaw and head pitch having the player look up down left and right is going to be handled by four separate animations and we can find those animations inside the model file so I'll add space for four new motion fields and then assign them as each of the look animations we have for our model finally we just need to correct our position values so for look left we're going to have a your of -1 and a pitch of zero for look right we'll have positive one and zero for the pitch for look up we'll have a your of zero and a pitch of one and the opposite for look down so zero and minus one and if we now test this out we can hover over our hotspots to have the player look at them and just give us a little bit more feedback that they're Interactive having configured our player character to look at hot spots in this way also gives us access to the other ways we can turn the character's head one way is to rely on the character face object action and then have the face with set to head and the other way is to rely on adventure creators head turning track and we'll be covering timeline and Adventure creators custom tracks for it a little later when we were creating the hotspot for this laser here I mentioned that the puzzle of this little game will involve turning it off but right now we don't really have any need to because uh it's not putting anyone in danger so let's fix that by putting someone in danger inside the tutorial files and then evil layer folder we've got this brain character who is also from the 3D demo and if we drag him into our NPCs folder you can see when he's got a position of zero zero zero he appears In Harm's Way on the slab here his legs are looking a little bit strange here but that'll all correct itself once he plays his animations so the first thing we're going to do is create an animator controller for him going to my 3D game folder I'll right click and create a new folder called brain and inside that I'll create an animator controller named also brain and if we double click to bring up the animator window and go back to the model file expand that we have a few animations that we're going to want to make use of for now I'm just going to drag in the trapped idle animation and make this the default and also drag in the look player animation which is similar to idle only he's turned his head to the side we'll control these animations using a bull parameter so inside my parameters tab I'll choose Bull and name it is looking at player and if that is true we'll transition from our regular idle to this look player Idol and the opposite for the reverse although poor brain is going to be trapped here for the whole game he is still going to be nnpc and we're going to have him speaking to the player so we're going to need to use the character wizard once more to convert him into an NPC so with him selected I'll go to Adventure Creator editors and then character wizard we're going to be creating an NPC and his name is going to be brain the game object to serve as his base is going to be El underscore brain and it's important to note that this can't be the skinned mesh asset it needs to be an object inside our scene choosing next again will confirm that we want to use mechanum finish up and you can see we now have the NPC component attached to him he's not going to be moving around the scene so I'm going to get rid of the move speed float and torque ball parameter fields the brain model doesn't have any talk animations but if we have a look at his skinned mesh renderer he does have a few phoneme blend shapes that control his mouth shape and we'll use these later to animate his mouth dynamically when he speaks for now though we're just going to focus on his interactivity and if we look a little bit further down his inspector you can see that we've got a capsule collider and a hotspot already attached and you can see that represented by this capsule here in the middle of the scene his model is actually a little bit offset and rotated so what I'm going to do is take the collider and hotspot components move them to a tiled object and then we can position and rotate them to fit the model A little better I'll go to game object create empty child name it hotspot brain go down to the bottom of his root copy the capsule Collider paste it onto my Hotspot brain object do the same thing for the hotspot and then remove both from the original route and since brain won't be moving around the scene I'll also remove the rigid body going now to the hotspot brain child object we can pick this up and move over so that it fits brain a little better and then as before we'll create a interaction Forum so to the right of the use interactions panel I'll click on the plus icon and you can see here we've also got this cursor icon field and before we were just leaving this as the default use but if I click we can choose what kind of interaction this is going to be this doesn't affect the actions involved it just affects the icon and hotspot label that might appear when we hover over it since we're going to be talking to brain I'll set this to talk to or create a new interaction and this time I'll set the player action to walk to marker and this is because we want the player to walk to a specific place before running the interaction we'll have the player move to around this spot here and looking a little bit further up in the hotspot component you can see we've got a walk to Marker Field I'll click on Create and you can see we've now got this marker hotspot brain object in our markers folder if I select it and look at it in the scene view you can see that it's represented by this Green Arrow and so what I'm going to do is just drop it down onto the floor where we want the player to begin the interaction from I'll turn it a little bit as well around the y-axis and then going back to the hotspot I'll check face after moving for this interaction we're going to create a conversation where the player can choose from a selection of dialog options and to make things look a bit more interesting we'll switch to a different camera while this is going on going back to the scene manager I'll create a new simple camera which is a camera that doesn't have any movement controls I'll name it brain conv camera and bearing in mind that our player character is going to be over this Arrow I'll just move it up and to the side so that both are in shot at the time maybe lowering the field of view a little bit as well now cut to this camera when this interaction begins so going to the brain talk to action list I'll bring up the action list editor for it and we'll begin with a camera switch action the new camera is going to be brain con camera and we'll just cut to it with no transition we saw earlier that our brain's animator uses a bull named is looking at player to determine whether or not the look player animation is playing and so we'll have this be true during this interaction I'll double click to select the text and copy it and then going back to the action list editor I'll click and drag out of this bottom socket here and release in some empty space to create a new action and this one is going to be a character animate action which the character is going to be brain and the method that we're going to use is change parameter value the parameter to effect is going to be is looking at player this is of type Bull and we'll set the value as true next we'll have brain say something so we'll create a new action making this a dialogue play speech action this time the speaker is going to be brain and the line text will be hey little help to give the player a response we're going to use a conversation and we can run a conversation using the dialog start conversation action this action requires a separate conversation object and we can create that inside the scene manager underneath the logic set of prefabs we can click to create a new conversation which I'll name at brain conversation and then looking at its inspector I'll click to create three new dialog options and set their labels to what we want to display to the player so for the first one I'll set it to held you get into this mess the second what should I do and the third as don't go anywhere these dialogue options have a few more properties and they mostly relate to the ability to run a separate action list when each of them are clicked these can be ignored however in favor of a much easier method and that's to rely on the same action list in which the conversation is called so if we go back to our brain talk to interaction and set our conversation to brain conversation I'm going to check override options and you can see we now get three sockets one for each of the dialogue options and using these we can create new action chains to determine what happens when we click on them so for example if the player clicks on how to get into this mess we can create a new branch of actions by dragging out a new action this time we'll have the player say the same thing so I'll copy paste the label and then we'll have another speech action to have brain respond with guess I found the wrong place to take a nap once this line has been spoken we'll have the conversation show up again and we can do that by dragging the output socket back on to our dialog start conversation action if we choose what should I do we'll do something very similar we'll start with a dialog play speech action in which the player says just that and we get a response from brain this time it'll be um help me turn off that giant Blazer and again we'll return to the conversation afterwards finally four don't go anywhere we'll have another pair of dialogue Place speech actions starting with the player saying just that and then have a response from brain and this time it'll be everyone's a comic since choosing this option will end the conversation we're not going to reroute back to the dialogue start conversation action instead we're just going to put the animation and the camera back to how they were before the first actions of this interaction are this camera switch and character animate actions so we'll run similar actions that undo their effects if I Marquee select both of these actions and choose copy selected I'll go down to the bottom here and paste in these copies reroute our third dialog options action chain onto the camera switch this time I'll check return to last gameplay and for the character animate I'll uncheck the set as value box since the action list then ends here this will cause the action list to stop running and will return to gameplay we're just about ready to test only I did forget one key thing and that is for brain to actually have the animator we created for him if I go back to the brain NPC I'll set the controller to the brain asset we made a little earlier we can now test this out and running the game we can click on brain and after a greeting by brain we then get our conversation options appearing on screen and we can click on them to choose what the player says there's a couple of things we can do to make this sequence a little bit more natural the first thing is when we cut back the camera to our last gameplay I'll insert a brief transition time of maybe about two seconds setting the movement method to smooth and the second thing is I'll make our conversation feel a little bit more natural by revealing the middle option only when we've chosen the first if we select the brain conversation object and go to its inspector I'll select this middle option here what should I do and I'll uncheck is enabled so that it's not showing by default we can turn this on using actions and so at the end of the first action chain I'll find the last speech spoken by brain click on the Cog icon beside it and choose insert after to automatically create and insert a new action into this chain this one is going to be a dialogue toggle option the conversation is going to be brain conversation we're going to control the second option what should I do and we're going to set it to on and this will mean that it turns on only when we've chosen the first our action list is starting to look a little bit messy so I can click on auto arrange to have everything made a bit more neat testing this once more we can walk over the brain we get only a couple of options but if I choose for first we then get all three and if I click on don't go anywhere we end this conversation with a slightly smoother camera transition the main puzzle of our little game here is going to revolve around turning this laser off in order to help poor brain here brain isn't going to let us forget about what we're supposed to be doing so we're going to have him say a few lines of speech in the background when the player is walking around the rest of the scene but we're only want him to do this while the laser is actually on and while we don't yet have a means to turn it off we do want to be able to keep track of whether or not this laser is on and we can do that using a variable this variable is going to be associated with the laser so I'm going to click on the laser gun here and then choose add component and then Adventure Creator logic and then variables this then allows us to create variables that are associated with this object so I'll click on create new component variable and I'll name it laser is on this is of type Boolean or true or false and I'll set its initial value to true and having created this we can now rely on it in our action lists so let's now have a background action list that just has brain giving off little Snippets of speech every now and then we can do that by going back to the scene manager and creating a new cutscene I'll name this uh brain background speech and then opening up the action list editor for it before we start editing the actual actions I'm going to click on the properties button to the lower right of it and this brings up the properties for this action list you can see its default when running field is set to pause gameplay and this will cause it to be a cut scene so as with the trigger we made earlier I'm going to set it to running background and that'll just mean that the actions we now Define aren't going to interrupt our gameplay so the first thing this cutscene is going to do is check the value of our laser guns laser is on variable and we can do that with a variable check action variables can come from a few sources Global being the default and this is game wide and defined in the variables manager but here we're using a variables component and so I'm going to set the source to component and the component is going to be laser gun the variable is going to be laser is on and we're checking if it's equal to true and if this value is true we're going to use a dialog play speech action in which brain says something like get me out of here we're going to want this action list to run in a loop but we'll have a little bit of a delay first so I'll drag out and create a new engine weight action and set the weight time to about five seconds let's say and after that's finished we'll loop back onto the variable check action similarly when we run this cutscene we're going to have a little bit of a delay before brain starts speaking so if I go back to the properties I'll set the start delay to maybe four seconds we'll want this action list to run whenever the scene begins and there's a couple of ways we can do this if we go to the scene manager you can see we have a couple of fields for onstart and onload cutscenes and we could assign it in both of these I prefer to reserve this for opening or introductory cutscenes whereas we want this particular cutscene to run on a loop during the whole game so instead we can go back to the inspector and choose add component Adventure Creator logic and then action list starter and this is just another way of running an action list when the scene begins you can see it's already assigned the action list to run as brain background speech and I'll just check run on scene start and load this means that when we now test out the scene it's going to wait for four seconds before brain says some speech and he'll do that on a loop every five seconds having demonstrated this now I think I'll raise these delay values a little bit so I'll set the start delay maybe to eight and the engine weight to 10. it would also be a bit more interesting if brain said something different each time and we can do that easily with a new action called a variable run sequence instead of the variable check running our speech action I'm instead going to reroute it to run our variable run sequence and I'll set the number of possible values to 3. this then gives us three output sockets and a different one will be run each time this action is run so for option 0 I'll drag back onto the dialog play speech we've made before and for options one and two I'll create a different set of speech actions both affecting brain but each saying something slightly different so for the second one I'll choose I really don't like giant lasers and for the Third I'm still in Mortal danger here for all three of these I want to have another delay and reroute back to our variable check action so I'll have both of these speech actions run the same engine weight that we made earlier just going back to our run sequence action I'll check run on a loop so that once he said all three he then goes back to the first one finally we'll want to make sure that our background speech doesn't play while we're talking to brain and we can do that by temporarily stopping the background cutscene while this interaction is running going back to our brain talk to interaction I'm going to right click in some empty space and choose add new action and this time is going to be an action list kill action I'll leave the source as in scene and I'll set the action list to brain background speech I want this to run as soon as this interaction begins so I'll click on the Cog icon and choose move to front I can click Auto arrange to bring everything back down when this interaction ends we'll want to restart brain background speech and we can do that by going to the bottom where we've got our character animate action and I'll just create a new action list run action again our action list will be brain background speech and that will cause brain to stop his background speech during his interaction now that we have a few objects in our scene that we can interact with let's have a look at the various interaction modes and the ways that we can customize this interaction system the interaction method is set in the settings manager underneath interface settings we have interaction method and currently this is set to context sensitive so if we want to interact with brain we can hover over them with the mouse and left click this is the most simple interaction type but we can still offer the player a bit more feedback in terms of what kind of interaction this is going to be if we have a look at brain's hotspot you can see that we defined a cursor icon for his interaction as talk to and the options available here are defined in the cursor manager if we scroll down to interaction icons you can see that we have use talk to and look at available as default options and we can make more by clicking the create new icon button you can see that each of these has a label and an icon and we can show both of these when hovering over a given hotspot we can first check change cursor based on interaction and then scrolling up to hotspot cursor we can check prefix cursor labels and if we now hover over brain we'll get the speech icon showing as well as the label talk to brain in the same way we can move over to this chair here and it'll say use chair with this mode we interact with hotspots by left-clicking but we can also run an examine interaction by right-clicking if I go back to brain's hotspot I can click on the plus icon beside examine interaction as a test I'll just create a simple dialog please speech action where the player says it's brain if we now try to select brain we get two icons showing that we can left click to talk and right click to examine if we still just want to show that single talk to Icon we can do that by going back to the cursor manager scrolling down to the bottom and setting the when using examine interactions are both available to display use icon this interaction method is the most simple to work with but it doesn't give the player too many options in so far as how they might want to interact with a hotspot if we change to one of the other methods we'll be able to Define more interaction types for a particular hotspot for example if we change the interaction method to choose interaction then hotspot we can create an interface similar to the classic LucasArts and Sierra games of old where we first choose a verb from a list or a cursor and then click on a hotspot if we go back to our cursor manager you'll see that the interaction icons panel has been updated and we can check for example cycle interactions with right click and this now means that we can right click on our cursor to cycle through all the different interaction icons that we've defined and if we then click on a hotspot that particular interaction will be run this means that we can then go and Define as many interactions for a particular hotspot as we like for example going back to our brain hotspot I can go and click the plus icon beside use interactions again this time I'll create two more setting the first to use and the second to look at both of them will set to turn to face and I'll create the interaction action lists as well for brain use I'll have a dialogue play speech where the player says um I can't free him by hand I'll have to find a button to help and for the look at interaction we'll have another play speech action where he instead says looks like brains got himself stuck again the third type of interaction method is choose hotspot then interaction and this mainly relies on a menu that pops up after we click on a hotspot for example if I now click on brain we then get the use talk to and look at options appearing as icons and we can click on one of them to run that particular interaction the fourth interaction method is custom script and this allows us to create our own interaction system and there's more details on that in the adventure Creator manual for the rest of this tutorial though we're going to be sticking with choose hotspot then interaction and we'll be restyling that interaction menu a little later after talking to brain we've established that we're going to need to find a way to turn this giant laser off so let's give the player a means to do that as part of the default interface we can hover the mouse over the top portion of the screen and access the inventory bar we're going to add something to the scene that the player is going to be able to carry with them to help them out inside the tutorial files evil layer and then set folder we've got this instruction manual that can tell you how to operate giant lasers if we have a look at its inspector it's just this Normal book and so we're going to add it over on this coffee table we have here right now we've got the coffee table obscured by this trigger we made so I'm going to temporarily hide it by going to the scene manager and then unchecking the visibility box for triggers I'll then drag this instruction manual model into the scene and we'll be making this interactive so I'll move it into my logic hotspots folder to make the boundary of the model interactive I'm going to add the Box collider component checking is trigger so that it doesn't interfere with any physics and then add a hotspot we can avoid using the scene manager just by going to add component Adventure Creator hotspots and then hotspot I'll give it a label of mysterious book as part of its use interaction I'm going to have the player walk over to it first so I'll set the player action to walk to marker and then Auto create a walk to marker for it I'll set this marker down onto the floor nearby create the user interaction for it and also check face after moving items in the scene are separated from items in the inventory so we're going to have to create this item in the inventory manager as well going to the inventory tab we can click create new item and for this I'll set the name to instruction manual and set the main graphic to one inside the sets textures folder we've got this book icon graphic we have some other properties for inventory items such as whether or not we carry it on start but I'm going to leave all of these as they are with the item now defined we can start work on our interaction so I'll open up the mysterious book use action list and we can add this item to our inventory by using the inventory add or remove action leaving the method as ADD and setting the item to add as instruction manual at the same time we're also going to want to hide this from view so that we can't pick it up again and the best way to do this is to just teleport it out of the way we can do this with an object teleport action we'll set the object to move as instruction manual and we'll then need to assign a marker to teleport it to we can do this back in the scene manager underneath the navigation panel I can click to create a new marker and I'll name this marker hidden and I'll move this so that it's underneath by quite a bit and then assign it in our object teleport action since our hotspot is labeled mysterious book we'll have our player character just read it as he takes it so we'll give him a dialogue Place speech where he says death lasers a primer could be useful testing this out we can walk over to the other side of the room here click on the mysterious book use it and after a bit of speech you can see that it's now added to our inventory we can make this interaction a little bit more interesting by adding some character animation and we can find such an animation if we find tin pots model file go to the animation Tab and select take book I'll add this animation to our animator first going to the player's animator controller then expand the model asset to find the robot take book animation I'll drag and drop it into the animator and then we'll have a trigger be used to play it back I'll create a new trigger parameter named take book and then create a transition from our blend tree to it unchecking has exit time but giving it the condition take book when this animation finishes we'll go back to the idle animation so I'll make another transition from take book back to our blend tree this time leaving has exit time checked we can now play this animation as part of our interaction if I right click in some empty space and choose add new action I'll use a character animate action in which we affect the player and we do so by changing a parameter value the parameter to effect is going to be take book and the parameter type is trigger while this animation is playing we're also going to want the book to appear in the player's left hand and we can do that with the character hold object action again we'll be affecting the player the hold method is going to be parenting object to his hand the object to hold is going to be our instruction manual and they'll be putting it in his left hand we have some angle values that we might need to play with but first we need to make sure that our character is set up to hold objects if we locate our tin pot player prefab you can see inside the player inspector we have a field for his left and right hand bone transforms and these can be gotten by expanding his rig so if I double click on his prefab file and have a look through his hierarchy you can see that we've got a bone named hold dot L and this is parented to his hand so we'll assign this in the player inspector going back to the player I'll assign hold dot L as the left hand and hold dot r as the right hand we can now come out of prefab mode and go back to our action list we'll have these two actions run for a couple of seconds by having a new engine weight action I'll set to maybe two and a half well then unparent the instruction manual from the player's hand we can do that with an object set parent action this will be affecting the instruction manual and we'll use the method clear parent at the moment these actions aren't actually running they're not part of the chain so what I'm going to do is now re-route this back onto our inventory add or remove action and then have this action list begin from our character animate action and I can do that by clicking its Cog icon and choosing move to front Auto arrange to make things a bit neater and we can then test our progress foreign just as with hotspots there are a few ways to interact with items but the default way is to click on them in our inventory so that the cursor becomes selected with that item and we can then click on a hotspot to combine it with as an example let's create an interaction for brain so we'll go back to brain's hotspot and at the bottom we have a panel for inventory interactions I'll create a new one and rather than having a cursor icon field this begins with an inventory item field where we can choose what inventory item this is going to be for so we'll leave it as instruction manual I'll create the action list and then assign it a simple dialog play speech action in which the player says I don't think reading him the story is the best idea right now inventory items can also appear in our interaction menu so if we click on brain we also have the ability to select an item from here having picked up the instruction manual from the coffee table and seeing it in our inventory now's a good time to take a look at save games Adventure Creator comes with its own saved game system and we can access it by going to the default pause menu choosing save and then clicking a save slot to demonstrate the way that the save system works I'll come out of play mode and re-enter it and then to load that file I go back to the pause menu choose load and then click on that save slot you can see after doing so our player's position has been correctly loaded the instruction manual is back in our inventory but there's still a couple of issues to contend with first of all the camera didn't cut as we loaded the save but more importantly the book is back here on the table the reason for this is that we need to tell Adventure Creator what kind of data we need to save AC will always save what it knows that it needs to and this includes things like the player's inventory and where the player is positioned but when it comes to objects in the scene such as the position of this instruction manual we need to tell Adventure Creator exactly how we want to save that data in the case of this instruction manual when the player picks it up we teleport it out of view to our marker hidden marker and so we need our save game data to include the position of this object this is done by attaching the correct remember component to it and we can demonstrate this by going down to the bottom of the instruction manuals inspector choosing add component and finding Adventure Creator save system and we'll then get a list of all of the built-in remember components available to us I'm going to choose remember transform as this will record the position rotation and scale values of the object it's attached to since we're changing the parent of this object I'll check save change in parent and you can see as part of this we've got a constant ID number defined and it's this ID number that is used in save games to identify it an ID number is also used by Adventure Creator to record the active camera and so with our two navigation cameras we'll need to make sure that these also have a constant ID they don't need to have any specific remember components attached so we can just add a constant ID component directly by going to add component Adventure Creator save system and then constant ID I'll save the game and then run a new test so I'll go and pick up the manual once more save the game and after restarting go to the load menu and load that save file you can see that now when we do it the instruction manual is correctly in our inventory we've cut to the right camera and the book is no longer on the table this process of adding the correct remember component to our objects is important to understand but it needn't be so complicated as having to work out what needs to be attached to what and that's because the whole process can be automated as an example I'll remove the remember transform component and get rid of the two constant ID components on our cameras and then going to the settings manager going to the save game settings panel we've got a button labeled Auto add save components to game objects and if I click that we'll be prompted about what's going on as well as to save the game and if we do this then Adventure Creator will go through all of the scenes in our build settings and try to add all of the components that it thinks we need so for example if we go back to our instruction manual we've got the remember transform added back the cameras both have constant IDs it's also gone and added other remember components for example inside our laser gun object we have a variables and the process has added a remember variables component that allows these variable values to be stored in save games now that we have our instruction manual for dealing with death lasers let's finally turn our attention to solving this game's puzzle by having a look at this panel here that controls the death laser we've got this laser button object so I'm going to create a hotspot in the usual way I'll go to the scene manager click on hotspot position this new one over the selected mesh and I'll name it hotspot panel I'll reshape it so that it only covers the top portion and maybe rotate it as well and as usual I'll go to the inspector rename the label to panel and I'll create a walk to marker just on the floor in front of it for this panel's interactions we're going to do a bit of camera work and animation that we're going to want to sync up together nicely and the best way to sync the two together is to rely on unity's timeline tool so we're going to create some timelines and have our interactions play them back our first interaction is going to be a simple use interaction that runs if we just click on the panel without using the book or create a new user interaction set the player action to walk to marker and check face after moving and then create the interaction this interaction is going to be an engine control timeline action and we then have to supply a playable director that we want to control so let's go and create that now inside the my3d game folder I'll right click choose create folder and name it timelines and inside I'll right click create and choose timeline I'll name this panel underscore use and then I'll drag it into some empty space in the hierarchy to add a playable director mapped to this timeline I'll uncheck play on the wake and then just to keep things tidy I'll make a new folder for it inside the hierarchy named directors reset the position and place our playable director inside if I double click on the playable field will bring up the timeline window that we can use to start building our little cutscene I'll drag it down to the bottom here and the first thing we're going to do is have the player play an animation in which he presses one of the buttons and we can find this animation inside the tutorial files evil layer tin pot and then expanding the tin pot model file where we have this press button animation because this timeline is going to be affecting our player character we're going to need to temporarily drop our player prefab into the scene file so I'll go to my player folder and drag my El tin pot player prefab into the scene before this interaction runs the hotspot will make sure that the player is positioned at this marker here so I'll first move the player over to where that marker will put in next going back to our timeline I'll click the lock button to make sure that it stays open and then we'll drag the scene instance of our player prefab into the panel on the left we'll choose add animation track and we then need to drag in the press button animation from our model file so I'll go to Tin pot find the robot press button and drag that into this timeline track I'll have this animation play a few frames after the start of the timeline and unfortunately for tin pot this is not the right button so it's going to cause a few problems for brain if we find the set folder and the laser gun model we have a move up animation that will have kick in next going to the set geometry folder inside our scene finding the laser gun I'll drop this as well into our timeline window choose animation track and assign this the move up animation and I'll put it a few frames after our robot presses the button this causes the laser gun to move a little bit too close to brain so we'll have to animate brain getting out of the way as well I'll find our brain NPC inside the NPCs folder and drop him in as before again choosing add animation track and this time we'll use an animation inside our brain folder expanding the El brain model and I'll drag and drop brain Dodge laser we could spend some time getting the timing exactly right but essentially we want to play things in this kind of order next let's work on the camera and we're going to use a couple of cameras to show the action so I'll go to the AC Game editor and create a couple of simple cameras I'll name this use laser cam one and use laser cam 2. the first one will show the player pressing the button so we'll move it over beside the panel and face the player here and the second one will have show the laser and brain trying to get out of the way having made these cameras we can now switch to them inside our timeline and we can do this with Adventure creators own main camera track we can create this track by clicking on the plus icon and choosing AC main camera track and creating new shots is then a case of right clicking and choosing add from camera and then choosing the camera we want to switch to we'll start with use lasercam1 which I'll shunt to the beginning of this timeline and we can preview this by opening up the game window while this is running and when we get to about this point in the timeline we'll cut to the laser cam 2 so I'll choose add from camera use laser cam 2. and snap it beside our first camera again we can play with the timing to make things feel exactly right and this is really the big Advantage for using timeline for cutscenes perhaps at this point in the timeline we might have brain give out a little bit of a Yelp and we can do that with Adventure creators speech track as before we can get this by clicking the plus icon and choosing AC speed track and if I click on the header for it you can see we can then assign which character we'll be speaking we want to assign brain as our speaker but because timeline is an asset file we need to assign a prefab rather than a scene object so what I'll do is Select our brain NPC in the scene go to our brain asset folder and drop him into there to create a new original prefab going back to our speech Track Inspector I can now drag and drop this into the speaker prefab field and then we can start creating speech lines for it by going back to the timeline window right clicking and choosing add speech playable clip the line text is just going to be a simple whoa and I'll reduce the clip length so it's quite short now that we've finished our timeline we can go back to the action list Editor to have our interaction run this timeline and inside the engine control timeline action we can now set the director to panel underscore use and we'll check wait until finish to have this sequence block gameplay we can test our progress by running the scene and if I go over to the panel here and use it a little cutscene then plays coming out of play mode we can see that we still have our scene instance of our player prefab present in the scene and if we want to go back to having our player character be spawned in at runtime we're going to need to delete this object now but if we then take a look at our timeline asset you can see that the animation track that controlled our player is now missing the animator and this is because it was referencing the object in the scene we can fix this very easily back in our engine control timeline action by checking remap bindings selecting the animation track that affects the player and then checking bind to player the second interaction will make for this panel will be in the case that we use the instruction manual we've picked up on it so this is going to be an inventory interaction and the inventory item is going to be instruction manual again we'll have the player action walk to marker with face after moving checked and I'll click to create a new interaction action list this interaction too is going to rely on a timeline so as before I'll go to my timelines folder right click and choose create timeline and this time we'll name it panel use book as before I'll drop this into the scene hierarchy parent it to my directors folder and uncheck play on awake if I double click on the use book timeline asset or bring up the timeline window for it and the tracks we're going to create are going to be quite similar to the one we've just made we're going to animate the player so again I'll drop my player prefab into the scene temporarily move them over to where the markup will place them when we run this timeline and I'll drag this object into the timeline window choose add animation track and we'll find an animation inside our tutorial files tin pot and then expanding the timpot model file this time we're going to use the slam panel animation where tin pot basically just gives up and slams the book into the panel this animation we'll need to have the book parented to his hand but we'll do that using actions later on next we'll have the laser animate off so we can go to our laser gun drag that in as a new animation track and we'll find an animation for that inside the laser guns model file and we'll use turn off as before we'll next do the camera so I'll click the plus icon and choose AC main camera track and another way to create camera shots is to just drag the intended camera into the timeline I think the use laser cam 2 we made earlier is going to be a bit zoomed in for this one so I'll duplicate it give it the name three and pull back a little bit like so I'll drag this into our main camera track and then trim it so that it ends in time with our laser gun turn off animation with this timeline now complete we can go back to our hotspot panel and start working on the action list that runs this before we run the timeline we're going to need to parent the book back into the player's hand so we'll do this with the character hold object action will be affecting the player and the object to hold will be instruction manual and it'll be in their left hand next we can run the timeline by creating an engine control timeline action the director will be panel use book we'll check wait until finish and as before we'll remap the timeline's first track to our spawned player and we can do that by checking remap bindings and check bind to player for the first track and this means that we can remove the temporary player instance we just added to the scene once this timeline has finished we'll remove the book from the player's Hand by using an object set parent action in which the object to effect is instruction manual and the method is clear parent and we'll also need to hide the instruction manual from view so we'll create one more action and this time it'll be an object teleport action the object to move will be instruction manual and as before we'll set the teleport to our marker hidden game object that we made earlier testing this out now we can run over to the coffee table here pick up this mysterious book go back to the panel and then click on the book icon and we'll solve our problem using some Brute Force having rescued brain from this giant death laser here we want our gameplay to react to this change you can see that brain is still complaining about a giant laser in his face and it's also possible to rerun the interaction by clicking the instruction manual on this panel here again earlier on we added a variables components to our laser gun here and in that we added a bull named laser is on and by default this is set to true this variable is used inside the brain background speech cut scene where we're checking to see if it's true and brain will only start speaking if it is as part of the panel instruction manual action list we can scroll down to the bottom and add a new action and this one will update this variable value so we can use a variable set action the source is going to be component because we're dealing with a variables component I'll assign the component as laser gun and we'll set the laser is on bull to false we can use this variable to update other interactions for example our brain talk to interaction has our various dialog option responses for our brain conversation and right now whenever the player asks what should I do brain replies with help me turn off that giant laser so let's update this so that he says something different if we've already done that I'll move some of these other actions out of the way and after the player asks what should I do I'll insert a new action after that this will be a variable check action again the source will be component and the component will be laser gun and if it's set to true then we're going to have brain speak as he was before if not he'll say something else so we'll have a dialogue play speech in which brain says something more like um nothing I'm fine now as with the other speech line we'll have this reroute back to our conversation so I'll click and drag this output socket back onto our dialogue start conversation action to prevent the player from messing with the buttons after doing this we could update the panel hotspots interactions with further variable check actions but it's also possible to just turn off the hotspot completely if we go back once more to our panel instruction manual interaction and at the bottom add one more action and this will be a hotspot enable or disable the hotspot to effect will be hotspot panel and the change to make will be disabled this is a change we'll want to see reflected in our save game system so we'll need to have the save game record the state of this panel and we can do that by selecting the hotspot choosing add component and finding the component Adventure Creator safe system remember hotspot on the topic of the save system when it comes to the laser gun we have a remember variables component attached to save the state of the laser is on variable but we also need to save the state of the animation itself we can do that by attaching a remember animator component to our object but this component works by reading the state of the animator controller that it's attached to right now our laser gun is animated only through timeline and so we're going to need a controller that keeps track of whether it's on or off inside the my 3D game folder I'll right click choose create and then animate a controller which I'll call out laser gun and assign it in the animators controller field and if I double click to bring up the animator window we're going to need two states and on State and an off State and we can find both of these animations inside the set folder and then expanding laser gun I'll drag in on first to make it the default and then add off as well to transition between these two we'll use a ball parameter so I'll create one named laser is on I'll check this box to make sure that it's true by default and then create two transitions from on to off and in reverse both of these will have has exit time unchecked and a zero transition duration when the player uses the book on the panel and turns the laser off we're going to need to update this parameter here and one way to do that is to go back to our action list and add a new action this time being an object animate action I'll set the animation engine to mechanim and we can then Supply the details such as the animator being laser gun the parameter to affect being laser is on the parameter type as Bull and leaving the Setters value box unchecked there is a more convenient way we can do this however and if we go back to the laser gun object what we can do is synchronize the value of this laser is on variable with the value of our animators laser is on parameter for this to work we'll need to make sure that both of these have exactly the same name so I'll click on the variable copy the text and use that to update the parameters label and then we just need to attach a component that can link the two together we can find this by choosing add component Adventure creator logic and then link variable to animator in this component we need to supply the shared variable name that's going to be laser is on and we then assign the variables and animator components if we test the game now we'll see that we get this warning message in the console just reminding us that the laser is on variable needs to support linking so I'll come out of play mode click on laser is on and then set link to to custom script testing the game again we can run over to the coffee table here pick up the book and to demonstrate the save system we can pause the game at this point by going to the pause menu choosing save if we then use the book on the panel here the laser will turn off at this point the panel is no longer Interactive and if we go and talk to brain and choose what should I do he'll no longer mention the laser and if we save the game in another slot we can load between the two games and the animation state of the giant laser is being correctly loaded now that we've created the main puzzle of our game we can start to add a bit more polish to it and the first thing we'll do is add an opening cutscene we'll have the camera pan down and focus on these lift doors here and then we'll have the player step out and then we'll smoothly transition our camera into gameplay as before with the panel interactions we're going to rely on timeline so I'm going to create inside my timelines folder a new timeline asset that I'll name evil layer underscore intro as before I'll drag and drop this into my scenes hierarchy uncheck play on awake and move it into my director's folder then going to the playable field of my playable director inspector will open up the timeline and then I'll lock it this timeline is going to involve a few tracks the first of which is going to be the camera so we'll first create a new camera especially for this timeline I'll create a new simple camera inside the scene manager and I'll name it introcam I'll move this camera so that it's facing the lift doors and then we'll have the main camera switch to this camera during the timeline I'll go to the plus icon inside the timeline window choose AC and then main camera track and I'll right click choose add from camera and select the intro cam to make things a bit easier to work with I'll dock the game window over on the side here just so that we can see both this and the scene window at the same time the lift doors here will be closed but the actual lift inside is just a static piece of geometry so to give the feeling that the lift is actually moving what we'll do is just add a bit of Animation to the camera so going a few frames into our timeline I'll drag our intro cam into the timeline and choose add animation track and then pressing the record button I'll go into the scene window select my intro Cam and just play around with its transforms a little bit this looks to be about right so I'll stop record mode and then we'll animate the lift Doors by finding the lift object inside our set geometry folder and again I'll drag that in to create a new animation track we have some animation clips for this object that we can use we can find these in tutorial files evil layer and then set and expanding the lift asset we've got close open and shut animations the shut animation is just a single frame animation that has the doors both shut so I'll drag that in to begin with and expand the duration so that we can grab it and move it around at the moment the camera settles will have the doors play the open animation and then after allowing some space for the player to walk through we'll then close them with the close animation to control the player as before we'll create an instance of our player prefab in the scene so I'll go to the player folder and then drag and drop the player's prefab into the hierarchy I'll then create an animation track for the player and because we'll remap bindings later I'll give it a name that we can identify so I'll call this player movement going back to the start of the timeline and going into record mode I'll select the player move them so that he's inside the lift doors here turning him as well as the lift doors open I'll add a new keyframe and then a few frames later we'll have him move out into the main scene stopping recording will then want to focus on the animation of the player right now he's just playing a single frame of his idle animation and what we'll want is for his walk animation to play while he's moving in one way to do this would be to create a second animation track for our player in which we manually control the idle and walk animations but when it comes to characters that are just walking around Adventure Creator is able to automate this using the character animation 3D track and if I create a new track that is mapped to our player I can right click and choose add character animation 3D shot and have it span the entire width of our timeline this animation track type doesn't work in preview but at runtime it should allow the player to transition to his walking animation based on the change in position between each frame I should note that this only works for characters that do not have apply root motion checked because we'll rebind this track later I'll rename this one as well so I'll select it and name it player animation before we call this done we'll just go back to the camera for a moment and the first thing I'll do is add a fade in effect when this timeline begins we can do that with an AC camera fade track and if I create a new shot inside this from text to 2D I can then select for example this black texture that will give us a full screen black effect whenever this track is active and this means that we can create a fade effect just by giving an ease out duration to finish up this timeline I think we'll also have a smooth transition from this intro cam to our main gameplay camera and we can do this by also adding an ease out duration to our main camera track and when we're previewing this this will just go back to the main camera's default position but at runtime this will go to our navigation camera I'll close this timeline window now save it and remove tin pot from the scene and then we'll need an action list that runs this timeline so I'll go back to my AC Game editor create a new cutscene which I'll call intro and opening up the action list editor again we'll use an engine control timeline action the director is going to be evil lair intro we'll remap the bindings and because we've renamed our player tracks these ones are easy to find so I'll click on player movement and then bind to player and then the same thing for player animation I'll also check wait until finish so that gameplay is not possible while this intro plays and then to have this cut scene run when the scene begins we can either attach the action list starter component to it or we can just assign it in our scene managers onstart cutscene field this cutscene is now going to run every time we start this scene and although this tutorial only covers this single scene in a proper project we'd likely be dealing with multiple scenes and so we'd typically want to control whether or not this timeline plays based on which scene the player is visiting from we can do this with a scene check action and then setting the check type to previous and then supplying the details of the previous scene and if we then place this at the beginning of our action list we could then use that to determine whether or not we should play our timeline because we'll have to watch this cutscene every time we now begin the scene now is also a good time to cover the way that we can skip cutscenes if we have a look inside the settings manager underneath the available inputs panel we've got listed a button named end cut scene and if we then Define an input with this name we can press it to skip any gameplay blocking action list we can add this now by going to edit and then project settings and inside the input manager I'll create a new input name it end cut scene and I'll set the positive button to maybe tab so if we test this out now by running the game and pressing tab we've skipped the cutscene and we're now in gameplay this feature isn't just limited to timelines we can also skip our interactions with brain here for example I can click on a dialog option and press tab to skip through all the speech if we want to prevent the player from being able to skip a particular cutscene we can do that by going to the action lists properties and unchecking the is skippable box carrying on with adding polish to our game the camera system we're using while we're in gameplay is a little bit basic we're able to follow the player as we move around the scene but it's a little bit difficult to know where the camera is going to be and it's limiting Us in terms of what parts of the scene we're able to see what we can do is replace this with a more modern over-the-shoulder camera and we can create such a camera in the scene manager by clicking on game camera third person this is a complex camera type and the inspector for it reflects this there are a lot of fields and the best way to figure out most of these values is really just to enter play mode and have a play with them but what we'll first configure are the spin and Pitch input fields which are used to control the camera's rotation right now these are set to horizontal and vertical which are the same as the player's movement keys so we'll have these instead controlled by the mouse going back to our project settings and then input manager unise's default input manager has Mouse X and mouse y inputs and these are mapped to the X and Y axes of the mouse so I'll click on Mouse X select and copy that and then paste that into the spin input box and for pitch input I'll set it to Mouse y we'll then need to set this camera as our scene's default by going to the top of the scene manager and setting our default camera from navcam1 to game camera third person if we then run the scene and after the intro has played we then transition to this new game camera and I can use the mouse to spin around and look up and down again we have a lot of settings in our inspector that can be used to find control exactly how things feel I think for the moment though I'll just increase the horizontal offset to about 0.4 so that it's a bit more over the shoulder we do need to make some more changes to our scene though and that's because we have some triggers over here that will cause the camera to switch back to our nav cam 2 and then to navcam1 when we exit so I'll come out of play mode and then finding this trigger nav cam I'll disable it and then I'll also make the same change to our horizontal offset I'll set it to 0.4 if we have a look at the opening cut scene we've just made inside the directors we've got evil layer intro and if I have a look at the Timeline our main camera transitions back to the default right at the end at the moment it transitions to this camera with the same rotation that it does here in the scene window if we go to the bottom of the inspector we can have the initial Direction take effect when we transition to it my checking set initial Direction when active this is set to behind Target which would have us end up inside the lift so instead we can set this to previous camera Spin and this will mean that the camera Begins the game with the same camera values that we exit the timeline with a quick note about skipping this timeline in order to have this effect work when we skip the timeline we just need to make sure that our main camera track has calls custom events checked and this just means that if we skip the cutscene like so the third person camera has the correct rotation if we now use our Mouse to rotate the camera and have a look at the way that hotspots could be interacted with we can hover over for example this chair here and we can do so from quite a distance and we can also do so through this wall here to fix the distance issue we can go to the settings manager scrolling down and then in the recast settings panel we can reduce the hotspot Ray length to something lower like 15. and in order for walls to block raycasts onto hotspots they need to be on the same layer as the hotspot layer here which is set to default so if we have a look at this wall here this is the platform game object earlier on we set this to navmesh and this was necessary when demonstrating point-and-click movement but since we're not using that we can set it back to default and our hotspots will no longer be interactive when they're behind something turning our attention back to the way the camera moves it can get a bit awkward at trying to select hotspots because the camera is moving at the same time as our cursor what we can do is lock this cursor in the middle of the screen and we can set this by default by going to the settings manager and underneath interface settings checking lock cursor in screen center when game begins if we want to hide the cursor when it's locked we can do that with the option below and if we scroll down back to available inputs you can see that there's one named toggle cursor and if we press this then we can toggle between locking and unlocking the cursor so let's try that now we'll go to edit project settings increase the inputs size by one and I'll name this new one toggle cursor and I'll set the positive button to left Alt we can still see the system cursor in the middle of the screen but that's only because we're in the editor and if I press left alt I can unlock the cursor right now you can see that we are still able to move the camera while the cursor is unlocked but we can fix this by going back to the third person camera's inspector and at the bottom check input requires locked cursor when it comes to selecting hotspots at the moment when we try to interact with brain here for example we can't do this until we come out of the locked cursor state so I have to press left alt to be able to select one of these options there are a few ways that we could improve this depending on what kind of game we're going for one option would be to go to the interface settings and change the select interactions by field from clicking menu to cycling menu and clicking hotspot and this would allow us to have a separate button that we can use to cycle through the different options this kind of behavior is better for when we're using perhaps a Gamepad and if we're sticking with a mouse and keyboard what we can also do is automatically unlock the cursor when the interaction menu opens to do this we can go to the menu manager which stores all of the menus that make up our interface and if we click on interaction we can see that we can optionally assign a couple of action lists that run when the menu turns on and off I'll create a couple of these and also make a special folder to put them in inside the my 3D game folder called action lists these action lists are similar to The interactions and cutscenes we've been working with before only these are asset files and can be run from any scene so in the interaction turn on action list will want to unlock the cursor and we can do this with a player constrain action and then set the cursor lock to disabled and for the opposite we'll go to interaction turn off have another player constrain action and set the cursor lock to enabled testing the game out now I can move over to brain I can click on brain and this automatically unlocks the interaction menu the only problem is that if I move the cursor too far the interaction menu automatically turns off what we can do to fix this is go back to the settings manager and set the close interactions with field to click off menu having switched to a more modern third-person camera helps to make this game feel a little bit more polished but having to lock the cursor in the middle of the screen does make it feel a little bit awkward to select hotspots because we now have to position hotspots right in the center of the screen going back to our settings manager and then looking down at the HotSpot settings we have our hotspot detection method currently set to Mouse over and we can set this either to player vicinity so the hotspots become interactive as we near them or alternatively custom script and this allows us to write scripts that cause hotspots to be selected by whatever means we need to the custom interaction systems chapter of the manual covers how this can be done but we can also find a number of preset templates available on the adventure Creator website we can grab these by going to Adventure creator online resources and then downloads and then on the downloads page we can scroll down to find a number of UI templates I'm going to download and make use of the screen space hotspot detection package which is inspired by Revolution software's recent Beyond a steel sky inside Unity I'll import the package which you can see has a number of scripts and prefabs which are then found in the adventure Creator downloads folder the readme file gives instructions on how to use this but the main steps are to leave our hotspot detection method as custom script and then place this screen space hotspot detection script in our scene so I'll create a new empty object call it hotspot detection and attach the script as a component this inspector comes with a few Fields but the default values are enough and essentially it works by hotspots being interactive when they're positioned inside a circle on screen we can run the game to test how things are going and you can see as we approach this panel here it becomes interactive even if the cursor is not directly over it and this package also comes with its own hotspot and interaction menus that we can obviously make use of to do so I'll first go back to the settings manager and set both the C interactions with field and the close interactions with to Via script only and again the instructions for this are all in the readme file next we'll copy over the hotspot and interaction menus so I'll go to my menu manager where we can see our current interaction and hotspot menus what I'll do is rather than delete them I'll just keep them locked so that we can go back to them if we choose I'll rename our existing interaction menu interaction underscore old uncheck start game locked off and I'll do the same thing for Hotspot to then copy over this package's version of these menus we can change our menu manager's asset file temporarily to sshd menu manager then click the Cog icon beside the interaction menu to choose copy go back to our own my 3D game menu manager paste that in and do the same thing for the hotspot menu testing the scene again we can now go over to the panel once more and we get a much nicer interface for clicking on this panel if I click to select we then get the various interactions available as a drop down underneath the hotspot name and it just becomes a bit more intuitive to use in the case of brain we're still not able to interact with them so I'll increase the detection distance to maybe five and I think I'll also go to the cursor manager and uncheck prefix cursor labels so that the hotspot label no longer changes when we hover over each interaction for something like the laser which is up high we might not necessarily want to increase the distance so far that we can reach it because this will make other hotspots interactive from a distance as well in this case what we can do is assign an interactive boundary which is a way of marking out exactly where we want a hotspot to be interactive back in edit mode if we go back to the Laser's hotspot you can see we have a field for interactive boundary and if I click to create this you can see it's represented by this green Cube what we can do is move it down and stretch it out and this will cause the laser to be interactive so long as the player is within this boundary let's turn our attention to the way speech is displayed and make our UI a little bit more consistent right now we're using the default subtitles menu which uses a different font to our hotspot one here so let's take some steps to tidy things up and make things look a bit more consistent the first thing I'll do is disable speech scrolling and we can do that just by going to the speech manager and underneath the subtitles panel unchecking scroll speech text this manager also gives us options for speech audio translations and lip syncing and we'll go into these a bit later on for now we'll deal with the subtitles menu and we can do that by going to the menu manager and then clicking on subtitles Adventure creators menu system works by defining menus that can appear at certain times and inside those menus defining elements such as labels and buttons our subtitles menu is set to appear when speech plays and further down we can see that it has two elements the first of which shows the name of the speaking character and the second displays the speech text itself Menus can be rendered in a couple of ways and this is set in the source option at the Top If we set this to Adventure Creator you can see that we can preview the menu itself directly in the game window and we can control these all within the menu manager itself this method is pretty good for prototyping because it's very quick and easy to use but for more stylistic control it's better to use Unity UI which is unity's own UI system setting our source back to Unity UI prefab means that the menu is rendered using a UI canvas instead and we can see this linked under the linked canvas prefab field so if we want to edit this I'll drag our subtitles UI into the scene and so that we can make it consistent with our hotspot menu I'm going to drag in the hotspot prefab as well going to the new hotspot menu we've just created I'll click on the linked canvas prefab hotspot UI and drag that into the scene as well you can see both of these use a different font and font size so I'll navigate to the text hotspot game object and we can see this is using the aerial font with a size of 14. so I'll use these same values for our subtitles menu I'll expand the subtitles UI and for both the text speaker and text subtitles we'll set the font to Aerial and use a font size of 14. if we want we can remove the black background for this menu by going to the panel game object and just unchecking the image component but this does make the text a bit harder to read but we can fix this by going to both and adding unity's outline component I should mention that Adventure Creator is also compatible with text mesh Pro and details for that can be found in the manual sticking with this though I think we'll next align the speaker label with the subtitles so I'll click on text speaker and then align to left and maybe set the font style to italic as well if we want we can also have this label appear in a different color depending on which character is speaking and we can do that by going to the elements properties so we'll go back to the menu manager click on subtitles and then Subs speaker label and then check use character text color a character's text color can be set in their inspector by default this is white and so we can change brains for example by going to his inspector and setting his speech text color to perhaps blue to make sure that these changes we've made to the subtitles UI are reflected in our game I'll click on the apply all button and then remove both this and the hotspot UI from our scene running our game now and talking to brain you can see that we're now using the updated subtitles UI I think the outlining is looking a little bit too thick and it's causing some breakages so what I'll do is go back to our subtitles UI prefab and just reduce the effect distance to maybe 0.6 minus 0.6 and I think we'll do the same thing for our interaction menu as well so we'll find the interaction menu then double clicking the interaction UI prefab and I'll just select all of these text labels and set the effects distance to 0.6 minus 0.6 I'll update the conversation UI as well and again we can go to the conversation menu open up the conversation UI prefab and I'll just get all of these text options I won't worry about the outline and background but I'll set the font to Ariel and the font size to 14. now that we've updated our subtitles UI you can see that the same UI is being used whenever brain runs his background speech and this gets a little bit intrusive I suppose when we're a little bit further away we don't want to be reminded so clearly of that brain is speaking to us and what we can do is rely on a separate menu for whenever a character speaks in the background first of all we can prevent background speech from being played in our regular subtitles UI by going to the menu manager finding the subtitles menu and then inside its properties we'll set the force speech of type field to blocking only and this will prevent background speech from showing what we'll now need to do is create a new menu to display our background speech so I'll click on create new menu and I'll name this subtitles brackets background it's worth mentioning that the order in which our menus are defined affects the order in which they're processed and while it won't affect anything here it is generally a good idea to keep the hotspot menu at the very bottom of this stack because its display might depend on other menus and I'll do this by clicking on the Cog icon to the right of it choosing rearrange and then move to bottom going back to our subtitles background menu I'm going to set the source to Unity UI prefab to keep it consistent with the others the appear type I'll set to when speech plays only this time I'll set the full speech of type to background only if we check duplicate for each line then each time the menu is turned on for a particular speech it will create a new copy of that menu and this gives us access to further options like this limit by Speaker proximity field that we can use to stop the menu from showing if we're a certain distance away from the character so I can set limit by distance to player and maybe set the max distance from speaker to maybe 15. for this menu we won't worry about showing the name of which characters speaking we'll just show their speech text itself so we'll just create a single element and if we go down to the bottom we can choose what element type will make speech comes from a label element so I'll create a new label and I'll name it background speech ignoring link text for the moment I'll set the label type to dialog line and one more thing I forgot we'll set the menu's position type so that it always appears above the character speaking and we can do this by setting the position type to above speaking character we then just need to create the unity UI prefab and Link it to this menu so I'll create a new UI object by going to game object UI and then canvas and I'll name this subtitles background UI Unity has also automatically created this event system object and Adventure creator has its own so I'll just delete this if we go into 2D mode in the scene View and double click on our new canvas object we can begin working on it so I'll right click and choose create empty and I'll name this label text and then add unity's text component we can give it some sample text to work with so I'll type in background speech goes here and we can make this a bit easier to see by toggling the effects button at the top of the scene window the font and font size fields are set to match what we had before but if we go into the game window you can see it's a lot smaller and that's because our canvas scaler is using different values so if I quickly go to the subtitles UI prefab and copy over the component values for canvas scalar go back to our subtitles background UI and paste those values back in then our background speech text will be of the same size again this is a bit difficult to see in game so again I'll go to our text object and add the component outline and set the effect distance again to 0.6 and minus 0.6 we can increase the width of this text box to give us a bit more space to work with and I'll also Center the alignment we're now ready to prefab this so I'll drag my subtitles background UI into my UI folder and then remove this from the scene going back to the menu manager I'll set the linked canvas prefab to this subtitles background UI prefab and we'll also need to assign the linked text object which we can access by double clicking on the prefab file and then selecting it from the hierarchy so I'll drag this label text into the link text object and you can see just like with the save system it automatically generating a constant ID value to keep track of this object at runtime in order to reposition a UI menu we also need to supply a wrecked Transform boundary and this will need to be a child of our canvas that can be repositioned by Adventure Creator if we were using a panel object in between our canvas and the text to maybe update the size of the text using layout components we would assign that but since we only have this label text I'll just drag that into the rect transform boundary if we close this and run the scene and although it is appearing in our menu our menu's position is not quite right you can see it's sort of positioned really in the middle of the scene and if we come out of play mode we can see that that's because uh it's actually positioning itself at the position of brain's game object whereas we want it to appear by his head we can fix this by going to his inspector and you can see further down we have a field named speech menu placement child so we can assign this to maybe his neck bone which we can find by expanding his hierarchy going through our brain hip Stomach back and then neck so I'll assign neck into this transform and then try this again and you can see brain speech is now appearing over his body another key aspect of subtitles is the ability to play audio whenever a character speaks and in order to do that we first have to have Adventure Creator gather our speech text all into one place we can do this from the speech manager scrolling down to the bottom and you can see we have this game text panel and currently it's reporting that it's gathered zero lines of text we have a gather text button and during this operation Adventure Creator will go through all of the scenes in our build so what we'll need to do is first make sure that we have this scene added to our build settings if we don't already we can click add open scenes to have it listed here I'll save the scene and then click on gather text and after a prompt I'll click ok you can see it's now added 77 lines of text and these have all been listed in the console window and if we now scroll down to the bottom here we can see all of our text listed by using the various filter options so if we leave the type filter as speech and set the scene filter to any or no scene you can see all of our games speech is listed here if we click on a speech line we'll get more information about it including a field for an audio path and file name and this refers to speech audio that we can optionally supply to have play when that speech line is spoken this manner of creating an audio clip of a particular file name in a particular file path is the default method but we have quite a few options to choose from if we scroll up to the speech audio panel you can see that our reference speech files is set to by naming convention and if we set this to by direct reference for example we can instead assign audio clips directly here in the speech manager the most performant method however is to rely on unity's addressable system and if we import unity's addressable package from the package manager we can choose by addressable and after following the instructions to add the addressable is present preprocessor to our player settings we can make use of addressable Keys instead what details can be found in the adventure Creator manual but I'll set this back to by naming convention which allows us to still run the game without issues if those audio files don't exist Gathering up our game text covers more than just speech and in fact all of our games text including hotspot labels inventory items and more are all included and so this is the first step in creating translations having gathered up our game's text we can then have a look at the languages panel and by default we only have a couple of settings for our game's original language but we can add a new one by clicking create new translation I'll set the label to for example French and if we then go back to our text entries you can see that we've now got a box for French translations so if we wanted to add a French translation for example this line of speech we could do so by selecting it and then typing into the French text box to make things a bit more convenient for translators we can also do this all in bulk and just above the filter options we can click export text to bring up the text export Wizard and this allows us to Define what columns we want to export as well as giving us some filtering and sorting options and we can then click export CSV to generate a CSV file that can be opened in spreadsheets such as OpenOffice or Microsoft Excel and once we've made necessary changes we can import that CSV back into Adventure Creator by clicking import text and then pointing to that file if we click on the create script sheet button it's also possible to generate script sheets as HTML files and these can be filtered by language or by character and so on it's also possible to Translate speech audio and you can see having created a new language we're getting an audio path field for French inside each of our speech line properties and this field is similarly affected by the reference speech files field so if I set this to by direct reference then our speech lines can have French Clips assigned here in the speech manager for the final topic of this tutorial we'll look into character facial expressions when it comes to facial animation and lip syncing Adventure creator has support for other assets such as Face Effects and also supports extension through custom scripting but here we're just going to rely on adventure Creator itself and when it comes to 3D games that involves using blend shapes if we have a look at brain here we can expand his object to find his skinned mesh renderer and we can see that he's got a number of blend shapes defined the first couple changed his expression we've got a happy and a sad one and the other five control his mouth movement that will make use of when we use lip syncing we'll come back to phonemes later because they'll build upon what we'll do with expressions and to control blunt shapes we first need to add a shapeable component so I'll go down to the bottom of this skinned mesh renderer and click add component and choose adventure Creator misc and then shapeable this component allows us to divide our blend shapes by category so that when we control one it will automatically affect others in that same group so as an example we'll create a new shape group name it expression and we'll create two keys the first one I'll name Happy and the second I'll name sad and you can see underneath the label we can then choose a blend shape so for blend shape sad I'll choose expression sad and going back to happy you can see that this one has expression happy assigned we can assign multiple blend shapes to a shape key so for example I could click on add new blend shape here and assign a phoneme with a relative intensity but for brain we only need one blend shape per key having created these shape Keys means that we can now control them during actions so for example where we have our brain talk to action list let's just open that up now we could add a new action of the type object blend shape a sign that brings shapeable component and we can use this to activate one of these shape keys and do it over a certain transition time for convenience there are a couple of other ways we can do this the first method is to Define Expressions on the character that we can then make use of we can do this by going to the NPC component and at the bottom we can check use expressions and then add a couple of new expressions and we just need to make sure that these match the names of the keys we made earlier so for the first I'll name it happy and for the second I'll name sad you can see that both of these have a texture field that we can assign and these are used if we rely on portrait Graphics that appear as part of our subtitles menu instead of this we'll rely on our shapeable component so I can check map to shapeable and then we just select the shape group that we want to link this to with these Expressions defined we can then activate them using tokens inserted inside speech text so for example our happy expression has a replacement token of expression happy and I can right click on this to copy that text and then paste it into a speech action so for example when brain says hey little help I'll insert this token at the start and that'll cause the happy expression to kick in in the same way we can go down to the bottom where brain says everyone's a comic and I'll put the expression sad token into there as well shape keys can also be controlled through timeline and this is especially useful if we're making cinematic games where timing is very important as an example we'll go to our panel use director open up the timeline for it because this is where brain nearly gets lasered and to control his shape Keys here we can go to the plus icon and choose AC shapable track I'll assign brings shapeable component into the field and then we can right click and choose add shapeable shot reduce the time and add a bit of blending and then in its inspector we just need to assign a group and key ID for it and we can get those by going back to our shapeable component and the ID is the value to the left of its name so the group ID is zero and we'll use the key ID of one this track type only works at runtime it won't work in preview but in game Brain will now look a little bit more appropriately scared when it comes to lip syncing we can rely on a similar process for our phoning blend shapes but we first need to configure the way in which lip syncing is processed we can do this from the speech manager lip syncing is a two-step process the first step is to extract or generate phoneme data for a character's line of dialogue and the second step is to process that on a model or Texture lip syncing is currently set to off but we can choose where AC gets its phoneme data from if we want we can make use of a number of third-party applications to generate phoneme data such as Pamela but the easiest though perhaps not the most accurate way is to rely just on the speech text itself we then choose what we want to perform lip syncing on portrait refers to a character's portrait Graphics that could be set to display in a subtitles menu but here we're going to affect blend shapes so we can set this to Portrait and game object we then need to click edit phonemes to bring up the phone use editor and it's here that we break our phonemes down into specific animation frames so for example I'll create a new frame and whenever the speech text has for example an M sound or an N or o or so on it will rely on this first frame of animation instead of typing these out by hand though we can just click on revert to defaults and this will give us a default selection of phonemes and frames and these all correspond to the phone in blend shapes on brain's model so if we go back to the skinned mesh renderer for brain you can see that for example for Frame 2 we have some U and O sounds and we can see that reflected by brain's phoneme 2 blend shape with these frames assigned we can then go and create a new shape group back in our shapeable component I'll name this phonemes and we'll then need to create a new shape key for each phoneme frame so I'll create five of them because this is all going to be automated the labels don't really matter so I'll just set the first one to phoneme 0. second to phone him one and so on for all five as with Expressions the final step is just to go back to brain's NPC component and assign it in as Inspector and for phonemes this is under the mechanism parameters panel and you can see we've got this phoneme shape group field that I'll set to phonemes as an alternative to this approach we can also rely on our animator controller and we can supply one or two phoneme related parameter fields that can be used in our controller to drive our animation testing this out we can now go back and talk to brain and you can see his mouth is now animating based on his speech text well this about wraps things up for this tutorial just to mention a couple of things I didn't already if we want to have music in our game we can do that with the sound play music action and from this action we can open up the music storage window that lets us Define any number of music clips which once assigned we can then control the playback off inside this action and secondly although this tutorial only took place in a single scene if we want to change the current scene we can do this with the scene switch action well I think that's about it now thank you very much for watching as always further tutorials both text and video based can be found on the adventure Creator website which we can open by going to the top toolbar and choosing Adventure creator online resources and then tutorials