Project
The Explorer: 3D Game Kit
3D Game Kit Walkthrough
Tutorial
Beginner
2 Hours10 Mins
Unity Technologies
Summary
This is an in-depth guide that will walk you from building a level using ProBuilder and PolyBrush through to using all the interactive features and set dressing found in the 3D Game Kit. Most of the tutorial steps can be used as stand alone walkthroughs but please refer to the related tutorials throughout for a more in-depth understanding.
If you want to get up to speed quickly please refer to the Quick Start Guide as it has smaller and more self contained tutorials and examples. To begin, make a new scene by following the instructions in Step 2 of the Quick Start Guide.
Language
English
Recommended Unity Versions
2018.1 - 2019.1
1.
Introduction to the Walkthrough
This is an in-depth guide that will walk you through from building a level using ProBuilder and PolyBrush through to using all the Interactable features and set dressing found in the 3D gamekit.
Most of the tutorials can be used as stand alone walkthroughs but please refer to the related tutorials throughout for a more in-depth understanding.
If you want to get up to speed quickly please refer to the Quick Start Guide as it has smaller and more self contained tutorials and examples.
To begin, make a new scene by following the quick start guide found here.

2.
Editing with ProBuilder
Your new scene will already have a square of ground that Ellen can run around on - let’s take a look at this now:
  • Navigate to the Hierarchy Window
  • Select the GameObject named Plane
 
This Plane has been created with ProBuilder, a tool that enables you to create and edit 3D objects in Unity. The ProBuilder Window is open as we have a ProBuilder Mesh in the scene.
 
If it’s not open, you can open it from the top menu;
  • Click on Tools > ProBuilder > ProBuilder Window
 

Greyboxing

Greyboxing is the art of creating simple shapes, or Geometry, in a scene to outline and plan a level you want to make. In game development this is the early stages of level design where you can quickly prototype and try out ideas. ProBuilder is a great tool for Greyboxing, so let’s create a new shape in our scene:
  • Go to the ProBuilder Window
  • Click on New Shape
 
This will also open the Shape Tool window.
 
The Shape Selector dropdown allows you to create many different shapes.
 
For now we’ll create a Cube, which is the default shape:
  • Select Cube
  • Set the Dimensions to 3,3,3
  • Click Build Cube
 
You have now built a cube in the middle of the scene. Since our Plane is a little higher than the center of the cube it will be intersecting with the Plane.
 
You can move the Cube using the Move Tool. Click on any of the arrows in the scene view to move it where you like.
You can change the shape of the cube by using multiple tools in ProBuilder. To learn more about creating 3D models inside of Unity using ProBuilder, check out the ProBuilder101 tutorial and the documentation.
For now let’s remove this cube:
  • Select Cube in the Hierarchy Window
  • Press the Delete (Cmd + Backspace on Mac) key on your keyboard
 
Next we’ll move on to editing and painting our ground plane.

3.
Making an Acid Pool

PolyBrush

The ground is made of a ProBuilder Plane. These are usually flat, but by using PolyBrush we can create an uneven surface and paint textures to make this Mesh resemble the ground. We’ll be making a dip in the ground where we can add in a pool of Acid as a hazard for Ellen.
Mesh: A mesh consists of triangles arranged in 3D space to create the impression of a solid object. A triangle is defined by its three corner points or vertices.
Note: PolyBrush is currently in Beta, so you may experience some bugs using this tool.
We can make this Plane a bit larger for the level we will be building by scaling it:
  • Select the Plane in the Hierarchy
  • Navigate to the Inspector
  • Set the Scale in the X Axis to 2
  • Keep the Scale of the Y Axis at 1
  • Set the Scale of the Z Axis to 2
 
Let’s open the PolyBrush Window and start editing:
  • Go to Tools > PolyBrush > PolyBush Window
 
 
Note: PolyBrush is currently in Beta, so the layout may change.
With the Plane selected;
  • Click on the Push/Pull icon in the PolyBrush Window
 
  • Select the Plane and then Hover over it in the Scene View
  • The Push/Pull gizmo will appear wherever you move your mouse.
 
  • Left click to raise the ground by pulling vertices up
  • Or Hold Ctrl and left click to lower the ground by pushing vertices down
Now you know the basics, create a small dip on your plane using Ctrl + Left Click to start forming a pool. This doesn’t need to be too deep.
  • Click on the Push/Pull icon again when you are done editing to deselect the tool.
 
You should have something similar to the following.
 
For more information on PolyBrush and how to use it, visit the Tutorials and Documentation
For now, let’s continue to make our first hazard.

Adding Acid

To find the Acid, we need to navigate to the Project window. This is where all the Prefabs and tools are stored:
  • Go to Assets > 3D GameKit > Prefabs > Interactables
  • Left-click and drag the Acid Prefab into the Hierarchy
The Acid will appear somewhere in your Scene. In Unity, you can locate an object quickly by Frame Selecting:
  • Select the Acid in the Hierarchy
  • Hover your mouse in the Scene view
  • Press F on the Keyboard
This will find and frame the Acid in the Scene view.
 
The Acid is currently too large, so let’s scale this down a little:
  • With the Acid selected, press R on the Keyboard for the Scale tool
  • Click and drag on the white box in the middle to make the Acid smaller
 
The Acid is also in the wrong position. Use the Move Tool (select the Acid and press W) to place the Acid just below the Plane, making it peek through slightly where you have made your pool.
 
You can continue to position and scale the Acid until you have the results you want.
Tip: The acid only needs to be just bigger than the space of your pool.
  • Press Play and test your Scene to check your bubbling Acid pool.
 
Note: When making a new Scene via the 3DGamekit toolbar menu, it will add a default DeathVolume area that is very large in size to allow you sufficient editing space. Be careful when lowering the terrain below this as Ellen will die on entry.
 
Top View - Default Level Death Volume
 
Side View - Default Level Death Volume

Adding a Death Volume

At the moment, Ellen can have a bath in the Acid and not get hurt, which doesn’t make it much of a hazard.
 
To make the Acid kill Ellen (sorry Ellen) when she steps into it:
  • Select the Acid in the Hierarchy
  • In the Inspector click Add Component
  • Type ‘death’ into the search box
  • Select the Death Volume script
 
This will add the Death Volume script to the Acid. This is a script we have made that instructs the game to cause Ellen to lose all her health.
 
  • Press Play and test your level. Try running into the pool of Acid, Ellen will die and respawn shortly after.

4.
Vertex Coloring with Polybrush
PolyBrush provides a very helpful 3D artist feature called Vertex Coloring that allows you to paint on the Vertex (The points that join together to make a surface) as opposed to painting directly onto the surface of the GameObject.
Similar to how the Push/Pull feature was used for creating the Acid Pool and Death Volume the painting will use the vertex to paint across the surface. The vertices are highlighted in the screenshot and the lines represent the polygon edges between them.
 
This may be strange at first as you may expect to be able to paint directly onto the surface whereas with vertex painting it takes the vertex and nearest vertices along the edge of the surface to "blend" the color/textures between them.
This is handled by the Materials which utilise Shaders (scripts) to group Textures (bitmap images) and render them on a GameObject. For a more detailed explanation of these topics please go to the Materials, Shaders and Textures page of the Manual.
To show this let's jump right in and start painting!

Painting and Materials

When you created the scene earlier using the kit the Plane was already created with a shader material attached to it. In the following steps you will see how this was created and dig deeper into what makes up the visual style and materials.
Let’s begin by setting up a basic plane and attaching a material.
  • Unless already open, open up the ProBuilder from the Tools > ProBuilder > ProBuilder Window
 
  • Select New Shape from the ProBuilder Window
 
  • In the Shape window select Plane from the drop down
 
This will add a plane to the Scene view with some default values attached, position it next to the default plane created earlier. To look like the one in the demo set the Plane values in the ProBuilder window to:
  • Width: 20
  • Height:20
  • Width Segments: 10
  • Height Segments: 10
 
In the Inspector view set the following
  • Position: X: -30 Y: 0 Z: -10
This should position the plane besides the existing plane generated in the level, if it does not perfectly align using the values, adjust as necessary.
 
Return to the Shape tool window and click Build Plane
Looking at the Inspector, you can see the Shader that is currently attached is simply Standard Vertex Color which will show as greyed out.
 
To change this you can add the the Materials created already in the 3D Gamekit. To locate these you can use the helpful Search by Type button  in the Project view and select Material from the drop down that appears.
 
This will update the Project view to show all the materials in the project.
 
In the 3D Gamekit the default Material attached to the main Plane is Default_Ground_Mat let’s filter the results further.
  • Type in default_ground_mat next to the t: Material text in the search field
 
  • Drag and Drop the Default_Ground_Mat.mat from the Project view onto the Plane in the Scene View to add the material to it.
 
Notice, in the Inspector that the Material has now updated to the Default_Ground_Mat
 
This will now allow you to use the material to paint on the Plane.
  • Go to Tools > Polybrush > Polybrush Window
 
  • Select the Paint Vertex Colors tab at the top of the Polybrush window
 
Notice how the texture is tiled across the Planes surface area with the default pattern on the left, and the vertex painted version on the right.
 
To see the textures that are currently mapped, go to Assets > 3DGamekit > Art > Textures > Environment > Ground in the Project view.
Tip: To navigate there quicker, however, you can use the Default_Ground_Mat Shader, click the arrow head next to the Material preview and select one of the textures, both methods will take you to the correct folder in the Project view.
 
To begin painting the new plane, select the Red paint from the Polybrush window to set the Brush Color.
 
This will allow you to use the mapped textures to paint, in this case the Moss_Albedo Texture to paint on the vertices.
Using the brush gizmo in the scene view, by moving it towards a vertex on the plane you can see the texture blending live in the editor, to make it permanent, simply click.
 
If you want to add some MuddyGround texture switch Brush Color to Blue and MuddyGround with SmallStone texture, switch Brush Color to Green in the Palette. This will give you a good variety on your surface.
 
Now it’s your turn to get creative with the brush! In combination with the Push/Pull, resizing of the brush and the Brush Colored textures you can create a great variety of painted meshes.
Tip: To try out the different colors you can live preview them in the editor to see the different textures and blending that is applied in the 3D Gamekit.

Removing ProBuilder Scripts from objects

When using ProBuilder created objects in your scene, it is best to remove the Probuilder scripts when you are finished editing to prevent any unnecessary overhead in your game. It removes the scripts from either individually selected objects or all ProBuilder objects in the scene.
  • Click on Tools > ProBuilder > Actions and then select either to strip all or simply strip from the individually selected object.
 
This action is permanent so ensure that you have made all necessary changes to the meshes and vertex painting before doing this, the editor will warn you before completing the action.

5.
Using Environment Prefabs
We have built Level Geometry for you to be able to place where you wish. These can be found in Prefabs > Environment.
 
As an example, let’s drag a rock model into the scene:
  • In the Project window, go to Prefabs > Environment > Rock
  • Click on CliffBig01
  • Preview this model in the Preview Window at the bottom of the Inspector
 
  • Left-click and drag on the model in the Preview Window to rotate it and view it from different angles.
Tip: If you cannot see this window, click on the grey bar at the bottom of the Inspector and drag your mouse up.

A note on performance

As you spin the model around, you will see parts of the model are missing. This is normal because a lot of the geometry is missing the back. This makes larger scenes perform better and stop them from slowing your computer down.
 
The more geometry and special effects you add into your scene, the more your computer will need to process. On some machines, this can be incredibly large amounts of geometry and effects, while on others it can be very little. Keep this in mind when building your levels and, if your computer starts to slow down when you press play, you may need to remove some geometry.
We have used a few techniques like the above, to let you build as much as you can. The project will automatically detect your computer’s hardware and determine how much geometry and effects you can see and how detailed they are, similar to how PC games change settings depending on your computer. In the event you need to reset these settings or they do not set up automatically, go to Kit Tools>Auto Detect Quality Settings.
 
If you want to change these settings manually and see the breakdown of the settings go to Edit>Project Settings>Quality. This will open up the information in the Inspector for you adjust as you see fit.

Level of Detail

Another technique we use to improve performance is the use of LOD groups. LOD stands for Level of Detail. Low-detail meshes are shown when the object is far from the camera and the difference will not be noticed. This is because meshes with simpler geometry are less demanding on the hardware.
Let’s look at CliffBig01 as an example;
  • Drag CliffBig01 into the Scene view
  • In the Hierarchy, click on the arrow next to CliffBig01 to expose its children.
 
Click on each of the Children and watch them change in the scene view;
 
Here we can see the detail changing, we set each of these meshes to be displayed at different distances from the camera.
  • Click on the arrow next to CliffBig01 to collapse it
  • Make sure CliffBig01 is selected
  • In the Inspector look at the LOD Group Component
 
Here you can see which models will be displayed at what distance from the camera. You do not need to change these settings as we have set them all up for you. The LOD group distances will be different depending on the quality settings that have been automatically selected for you.
For more information on LOD Groups, you can see our Documentation

6.
Rock and Vegetation Painter
To further spruce up your scene, we have created a Rock Painter and a Vegetation Painter. These tools allow you to place vegetation and rocks with varying sizes and rotations while keeping them aligned with the surface you are painting on.
To use these tools;
  • In the Hierarchy locate VegetationPainter
  • Click on the arrow to expand its children
 
  • Click on GroundCover
  • Hover the mouse over the ground in the Scene View
  • Left click to place some grass/lilly pads where you desire.
 
You can change the type of object being placed to do this;
  • Navigate to the Inspector
  • In the Instance Painter component there are pictures of each prefab in the painter.
 
  • The selected prefab will be grey
  • Click on the white highlighted box to select that Prefab to paint with.
Controls for the painter can be found at the top of the Instance Painter Component, some controls to get your started:
  • Left Click : Paint
  • Ctrl (Cmd) + Left Click : Delete
  • Alt + Scroll : Increase Brush Size
  • Space : Randomize positions and rotation
Any object you paint on will be stored as a Child of the Parent. For example;
  • Navigate to the Hierarchy
  • Expand GroundCover
 
Every object of that type from the paint will be stored here as a child. You can also click on these to individually edit and place them.
The process is the same to paint VegetationSmall, VegetationMedium & VegetationLarge
 
Painting rocks is done in the same way;
  • In the Hierarchy find RockPainter
  • Click on the arrow to expand its children
  • Click on RocksSmall
  • Hover your mouse over the desired area to place rocks and Click to place.
 
These tools help you to quickly add variation in the way you decorate your level. These can be found and placed the traditional way of dragging in prefabs from the Prefabs folder.
  • Go to Project Window
  • Go to Assets > 3DGameKit > Prefabs > Environment
Here you can find folders for Rocks, VegetationSmall, VegetationMedium, VegetationLarge.
 
You can click and drag any of these into the Scene View to place them in your level. Please note that position, rotations and size will not be randomised when dragging objects in this way.
Continue to place objects in your scene. Don’t forget to occasionally test your level by pressing Play to see how things are looking in the game.
We’ve created a small environment to show you game mechanics in the following chapters. Have fun and get creative with your level building!
 
 

7.
Organising Your Scene
When creating any scene in Unity, it’s important to keep things tidy in the Hierarchy so you can easily find objects or game mechanics you are looking for. The following are some tips to keeping your projects nice and organized although are not mandatory to use the Kit.
In the Hierarchy we have created sections to help order types of objects in our Scene.
 
These are made of empty GameObjects. They have no function other than to help us identify the types of objects in our scene. Note that all the objects underneath each named section are not children of that section and they shouldn’t be.
Let’s create a new section to store all of our extra level decoration;
  • At the top of the Hierarchy go to Create > Create Empty
 
This will create a new and empty GameObject named GameObject at the bottom of your Hierarchy
 
In the Hierarchy, make sure that GameObject is highlighted blue, indicating you have it selected. We can now rename this;
  • Navigate to the Inspector
  • At the top of the Inspector click on the Name Field
  • Enter the name ----- Environment -----
Naming the sections in this way will help you find objects when you have a lot more.
 
Now let’s move CliffBig01 into the right section so we can find it easier later.
  • In the Hierarchy locate CliffBig01
  • Left Click, hold and drag CliffBig01 until it is under ----- Environment ----- then let go of the Left Click
 
Tip: Make sure you do not let go of Left Click on top of another object as this will make it a child.
There is a visual indicator when something will become a child of an object when dragging, it will appear like this;
 
Ensure you see a horizontal line when you drag the object underneath ----- Environment -----. This indicates that it will place the object underneath like this;
 
In the event that you accidentally place it as a child of the label, you can simply move it back and try again.

8.
Game Boundaries
When building a level you may find that in testing you can easily escape from your level and get outside where you want a player to be able to go. This can’t always be fixed by adding more geometry, we can add invisible walls to prevent players from being able to escape.
We can do this by adding a Collider on an empty GameObject and adding it to our scene;
  • At the top of the Hierarchy go to Create > Create Empty
  • In the Inspector Rename this to GameBoundary
  • In the Inspector click Add Component
  • In the search box type in Box Collider
 
  • Click on Box Collider to add it to the GameBoundary GameObject you just created
Now let’s locate this object in your Scene;
  • Select GameBoundary in the Hierarchy
  • Hover the mouse over the Scene View
  • Press F on the Keyboard to Frame Select the Object.
 
The Box Collider is visible by a green outline. Position, rotate and scale this object to any problem areas in your level.
We need to ensure that this Collider will stop Ellen from being able to pass through it. We have set up a specific Layer for this, with GameBoundary selected;
  • In the Inspector click on the Layer drop down menu
  • Left Click on Environment to set it to that Layer.
 
We have placed ours in an area where the player can easily jump up and escape, don’t forget to test your game boundary by pressing Play.
 

9.
A Deeper Look at Moving Platforms
We will take a look at adding various gameplay elements using the Kit. We have set up a demo level to show these, you can use your own scene you have built to follow along or use a new scene.
If you have used the 2D Game Kit, some of these techniques may be familiar although we have adjusted some elements to simplify workflow.
Moving platforms can be used to get your player from one place to another, let’s add one to our scene;
  • Navigate to the Project Window
  • Go to Assets > 3D GameKit > Prefabs > Interactables
 
The Interactables folder is where you can find premade gameplay elements created for this Kit.
  • Left Click and drag the MovingPlatform Prefab into the Scene View OR the Hierarchy
  • Note: if you move this into the Hierarchy don’t forget to use Frame Select to find it (Keyboard Shortcut - F)
  • You can also position, rotate and scale the object through the Inspector in the Transform Component
 
Tip: Hovering your mouse over X, Y or Z and Left Click drag left or right will increase and decrease these values respectively.
  • Position the whole object where you would like the platform to start from.
We have positioned ours above the Acid pool we created earlier.
 
Now let’s take a look at making the platform and setting its path, to change where the platform will move to.

Gizmos

The moving platform comes with 3 gizmos attached to allow you to easily alter the motion of the platform. In the screen, you can see that it allows you to set the Transform Position to place it in the world (1), Starting position (2) and Ending Position (4) with the distance (3) between presented on the dashed translation line.
 
In the Inspector window, find the Simple Translator (Script) and check the box for Activate to enable the movement of the MovingPlatform.
 
If you’ve moved the Start location during this process before checking Activate, you will notice that the Moving Platform snaps to the Start location as opposed to the initial position set in Transform. This is to ensure the platform always starts from the right place and translates according to behaviours set in the Simple Translator Script.
Tip: Holding the Ctrl (Cmd) key when moving a gizmo snaps it to the grid and increments movements, this can really help in getting straight paths.
Ellen needs to traverse the environment and avoid the acid pool, therefore the End Gizmo needs to be adjusted or it will just do the default Translate on the Z Axis which is not very helpful to the player.
To see the current translation motion of the Moving Platform in the Editor, you can move the slider for Preview Position in a range from 0 to 1. You will see in the Scene window that the platform moves to where it would be in the game at that stage of the translation.
 
This is a very useful feature to help you see any potential overlaps with other GameObjects in the scene or preview the behaviour.
Duration
To alter the speed of the sequence from Start to End, you can change the Duration value which, is set to 5 by default and is measured in Seconds. Making this value smaller will result in a faster sequence and larger results in a slower translation.
Setup Moving Platforms
  • Click on the Y handle (Green) on the End Gizmo, Press Ctrl (Cmd) to snap, then drag it down to your desired height.
 
In this example, we want it to be a straight translation downward. Drag the End Gizmo’s Z handle (Blue) and Snap (Ctrl/Cmd) drag the Gizmo to below the Start Point.
 
If you move the Preview Position slider now, the Moving Platform should move towards the new End Point position.
  • The last step for this example is to set the Loop Type to Ping Pong which is currently set to Once. Changing this will repeat the sequence from Start to End and back again.
 
Loop Type
Once - Linear - moves from Start to End and stops upon reaching End
 
The Once loop type is most commonly used when you only require the player to be transported from the Start to the End.
Ping Pong - Two Way Loop - moves from Start to End and then End to Start giving a continuous motion loop.
 
The Ping Pong loop type is most commonly used when the route the platform provides for the player should be continuously available.
Repeat - One Way Loop - moves from Start to End then returns to Start to repeat.
 
The Repeat loop type is most commonly used for single direction sequences where the platforms would spawn in from Start and move to End. This can be seen in Level 2’s acid pit of the 3D Game Kit (3D Game Kit > Scenes >Gameplay).
 

Game Commands with Pressure Pads

Game Commands enable GameObjects in your scene to communicate with other GameObjects by sending and receiving commands. This helps you design complex behaviours and scripts.
Game Commands are based around Events taking place and vary per object in the 3D Game Kit. In this example we will look at setting up a PressurePad Prefab that will activate the MovingPlatform Prefab added in the MovingPlatforms tutorial using Game Commands.
  • To prepare the MovingPlatform for interactions from the PressurePad, disable the Activate property.
 

Linking Interactable Objects

 
  • Go to the Project view and navigate to 3DGamekit > Prefabs > Interactables .
  • Drag and drop a PressurePad from the Project window into the Scene view near the MovingPlatform that you are going to couple the PressurePad with.
 
In the Inspector, the component that you will be editing is Send On Trigger Enter script.
 
This Script will allow you to hook into other GameObjects by using the Interactive Object selection, which links the Game Command Receiver to the relevant GameObject in the Hierarchy.
In this example, we will link to the MovingPlatform already in the Hierarchy view.
  • To do this, click the Selection button for Interactive Object, select MovingPlatform and set Interaction Type to Activate.
 
You should see a link line with directional arrow heads in the Scene view from the PressurePad to the MovingPlatform. This visualises the relationship between the two GameObjects and shows the flow of Sender to Receiver for Game Commands.
 
  • Play your game and walk on the One Shot PressurePad (it should stay pressed) to activate the MovingPlatform and begin the looping sequence.
 

10.
Using Counters and Switches
We can connect several objects together. Next, we’ll be looking at using a Counter to count 3 switch activations before opening the door.
  • In the Hierarchy, select the Switch
  • Press Ctrl + D (Cmd + D on Mac) to duplicate the Switch
  • Repeat this one more time to get another Switch
You should see Switch, Switch (1) & Switch (2).
These will appear at the very bottom of the Hierarchy. To keep your project organized, Ctrl + Click (Cmd + click) each of these and drag them close together in the Hierarchy.
 
They will duplicate in the same place as the original;
  • In the Hierarchy, select each of the switches individually and position them one by one so they form a row.
 
You can also see that as we have duplicated the object, it has also duplicated it’s connection to the door. Colliding with any one of these switches will open the door. You can press Play and give that a try if you wish.
We want to open the door when all 3 switches have been activated;
  • In the Project Window go to Assets > 3DGameKit > Prefabs > Interactables
  • Find the Counter prefab and drag it into your scene
  • Position it near your switches
 
This object has no physical presence in the scene as it will hold game mechanics, you can see it by using the Transform Tools. Since we can’t see it in the scene, we will be selecting the Counter through the Hierarchy.
Tip: You can make these kinds of object more visible in the Scene View by adding a label;
  • Select the Counter.
  • At the top of the Inspector, click the Blue box.
  • Select a colour label from the drop down.
 
This will add a label to your object.
 
If you can’t see it, you may have your icons too small in the scene view. You can change this;
  • At the top of the scene view, click the Gizmos drop down
  • Adjust the slider which will change the size of the icons in the scene view
 
Now that we have a Counter in the scene that can count a number of senders, we need to send the Counter the "Open" Game Command from each Switch.
  • In the Hierarchy, select Switch
  • Click and drag the Counter into the Interactive Object slot in the Send on Trigger Enter script
This will replace the Door as the object to send a command to.
 
The arrows will appear to be connected to the Counter in the Scene View.
 
  • Repeat the above steps with Switch (1) & Switch (2)
All 3 switches will now be sending a command to the Counter
 
We can double check this in the Game Command Receiver script on the Counter.
 
Now if we enter Play mode and run into each switch, nothing will happen. We need to tell DoorSmall to open when the Counter has reached 3.
  • Select the Counter in the Hierarchy
  • In the Inspector, change the following settings on the Gameplay Counter script
  • Interaction Type: Open
  • Is One Shot: True (tick the box)
  • Target Count: 3
 
This will receive a command of type Open, only count once and set the target amount to fulfil the counter at 3.
Now let’s make the Counter send a Command to the door.
  • With the Counter selected, input the following settings on the Send Game Command script
  • Interaction Type: Open
  • Drag DoorSmall from the Hierarchy to the Interactive Object slot
  • One Shot: Enabled (tick the box)
 
Now each switch will send a command to the Counter and the Counter will send an Open Command to the door when it has received 3 commands.
 
Test your level by pressing Play. You should be able to collide with each switch and the door will open when you have done all 3.
The Counter can be used for many conditions that requires a measure to take place. The Send Game Command allows various Interaction Types beyond Enable and Open:
 

Indicating Progress to a Player

Usually in games we would place these sorts of mechanics far apart from each other. We have done this in the example game with this project. It’s generally good practice in game design to indicate progress to a player, whether through a User Interface or indicators in the game.
We’ll be adapting our Game Command and Counter to show Crystals lighting up near the door when each switch is used. This will show a player that there are 3 switches in the world for that door, and indicate how many they have activated.
  • In the Project Window, go to Assets > 3DGameKit > Prefabs > Interactables
  • Find the Crystal Prefab and drag it into the scene
 
The Crystal is a little large for our level, so let’s resize it;
With the Crystal Selected in the Hierarchy
  • Go to the Inspector and take a look at the Transform component
  • Set the Scale to the following;
  • X: 1
  • Y: 1
  • Z: 1
 
  • Place your Crystal somewhere near your door using the Transform Tools
  • With the Crystal Selected in the Hierarchy, press Ctrl + D (Cmd + D on Mac) twice to duplicate it twice.
  • Select Crystal (1) and Crystal (2) in the Hierarchy (Ctrl + Click or Cmd + Click on Mac) and drag to reorder them near Crystal
 
  • In the Scene View, use the Transform Tools to position the Crystals to desired locations
 
We have placed ours just next to the door to make it obvious to a player. Let’s make them change colour when a switch is activated;
  • In the Hierarchy, select the Switch
  • In the Inspector, scroll down to the bottom and click Add Component
  • In the search box type ‘Send on Trigger Enter
  • Hit Enter or click on the Script called ‘Send on Trigger Enter’ to add it to the Switch Object
 
This will add another Send on Trigger Enter script to the Switch. We can use this to send a command to the Crystal to change colour when the switch is activated.
  • Set the values in the Send on Trigger Enter script we just added to the following;
  • Interaction Type: Activate
  • Drag Crystal from the Hierarchy into the the Interactive Object slot
  • One Shot: Enabled (tick the box)
  • Layer: Player
 
This will send a command to the Crystal to activate when the Switch is activated.
 
Test the mechanic by pressing Play. Make Ellen run up to the first switch and it should also activate the first Crystal.
 
Repeat these steps for each remaining Switch and Crystal combination. Be sure to match Switch (1) with Crystal (1) and Switch (2) with Crystal (2). Each Switch will now send a command to the Counter and their Crystal.
 

User Interface (UI) Prompts

To finish off the switches gameplay elements we need to give the user a hint as to what the switches are doing and the importance of them. This is most commonly done via dialogue from the protagonist to the player. In the 3D Game Kit, this takes the form of an InfoZone Prefab.
  • In the Project view, go to 3DGamekit > Prefabs > Interactables and select InfoZone prefab
<IMAGE>
  • Drag infozone into the Hierarchy under the group for ----- UI -----
Remember to add it below the Empty label
  • Move the sphere collider over the switches and resize it to include all 3 switches in the area but not too far because you don’t want the trigger showing when Ellen is far away from them.
 
  • Set Layer to Environment if it has not set automatically in Inspector
 
  • Set Is Trigger to enabled for the Sphere Collider component in Inspector
 
The next step is to link the DialogueCanvas Prefab that will allow the game to tell the player the required information about the switches when they enter the trigger zone using Game Commands.
  • Go to 3DGamekit > Prefabs > UIPrefabs and find the DialogueCanvas Prefab
 
  • Drag a DialogueCanvas into Hierarchy under UI
  • Deactivate it as we only want it to display when the player enters the trigger zone of the InfoZone
  • Select the InfoZone in your scene and find the Interact on trigger Script component in the Inspector
  • Set Layers to Player if it has not done automatically
  • Set On Enter (Object) and On Exit to the Dialogue Canvas Controller Script by dragging it into the empty object slot
 
  • Set On Enter Function to ActivateCanvasWithText from the DialogueCanvasController Function list
  • Update the text field to provide some useful text to the player. We used the following
  • "If I switch all of these on maybe the door will open."
 
  • Set the On Exit Function to DeactivateCanvasWithDelay and set Delay equal to 1
 
Now that these are all placed, you can move the switches and crystals to other areas and hide them from the player to make it more challenging. The Game Command links will remain attached and allow you to use the objects more dynamically in your level. Be sure to add the DialogueCanvas to areas where you require the player to be notified of key gameplay mechanics in your project.

11.
A Deeper Look at Enemies
The 3D Gamekit contains 3 pre-made enemies: Chomper, Spitter and Grenadier.
They are all controlled by the EnemyController script and each one has a specific behaviour attached to them (ChomperBehavior, SpitterBehavior and GrenadierBehavior).

Chomper

 
Chomper is a melee enemy that will run towards the player when it spots them, and attacks when close enough.
Time to stop pursuit is how long (in seconds) the player has to get out of the Chomper's line of sight before it stops pursuing the Player and returns to its original spot.

Spitter

 
Spitter will launch an exploding acid spit toward the Player when she is spotted. If the Player gets too close to them and they are not currently spitting, they will try run away.
Flee Distance: when running away, once they’re far away enough from the player, they stop fleeing and resume attacking.

Grenadier

 
Grenadier is a tougher, bigger enemy. It will launch bouncing grenades toward the Player if they are far away, punch them