Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Adding Input Axes manually
If you import the asset into a project without the Project Settings, you have to add these axes
(inside the yellow color) into the Input Manager of Unity if you are going to use a gamepad, in Edit->Preferences->Input. These axes are used for the gamepad, but it needs to be configured if the settings of the asset are not imported (This step won’t be necessary in the next update).
These are the input added for 4 players using the gamepad, but you can add just one if you are not going to use the local multiplayer.
The values to configure are the following:
Right now, the input for 4 players has been configured, to be able to use the local multiplayer system. The settings are the same as above but configuring Joystick 2, 3, etc… and you can add as many gamepads as you need (though the limit is 16 players if I remember properly).
There is also a manual mode to create a new character. This mode is used when the automatic system hasn’t assigned the bones as the character needs (due to a special skeleton hierarchy). For this, follow these steps:
Drag and drop a player’s prefab in the scene.
Drag and drop the new model you want to assign to the player.
Open Build Player inspector, set to true the field Assign Bones Manually, and assign the new model in the field New Character Model:
Press the button Search Bones On New Character and the bones needed will be assigned in the inspector automatically:
Then, assign the bones (in case that weren't assigned correctly with the automatic mode) and press the button Build Character, so the old player’s model is replaced by the new one, and all the fields needed are assigned.
The same can be done with the ragdoll (by default the ragdoll is created with the above process), so bones can be assigned manually to add the ragdoll parts on them properly in case the system didn’t create it correctly.
Go to the Ragdoll Builder inspector and set to true Assign Bones Manually.
Make sure the animator of the player is assigned in the field Animator.
Press the button Search Bones On New Character and the bones will be assigned automatically, like in the build player:
Assign the bones that weren’t assigned properly and press the button Build Ragdoll. The ragdoll will be added like this:
Game Kit Controller video learning resources.
Apart from the Getting Started section of the documentation, we also offer a wide variety of tutorials that address all the different features and game play mechanics in GKC.
Do you know of a video tutorial that's not included? Let us know and we'll check it out for including here!
We have a an ever growing GKC Tutorial Playlist over on YouTube that covers many aspects of Game Kit Controller and what you can do with it.
While you're there why not also check out the GKC Preview Playlist which contains loads of feature and game play mechanics previews.
Looking for inspiration and examples of what others are making with Game Kit Controller?
How to set up a new Humanoid Character
To set your model, follow these steps:
In the tools bar press Game Kit Controller and Create New Character.
In that window select a humanoid model and press the Create Player button. If you are in the Scene window, set the camera in the position where you want to place the player once is created.
The new player will be placed in the scene, in the position where the editor camera is looking.
This process creates the ragdoll of the new player automatically. Here you can see how it looks.
IMPORTANT: the position and rotation of this object, Player 1 and Character and HUD elements must be (0,0,0) for both fields, if you drop the player prefab in the scene, that will be the values by default.
• This ragdoll can be configured or removed. For this go to Ragdoll Builder inspector, in the GameObject called “Character” and press the button Remove Ragdoll. You can also configure its scale and mass in the option Bone Settings.
Then you will see the messages in the console about the weapons.
These messages is to tell the user to configure the correct weapon parent, which is the place where every weapon is parented while is not being used, like the back, the leg, etc… By default, the weapon is placed in the back. To configure a better parent check the next steps.
How to manually add the Tags and Layers needed for Game Kit Controller
In case you import the asset to a project without the Project Settings, you need to add the Tags and Layers used in this asset. To do this automatically, you need to go to the demo scene in the asset, or drag and drop the prefab Player And Game Management. Then, go to the inspector of that gameObject and go to Tag Layer System inspector.
Open the Tag Menu and press the button Add Current Tag List.
Do the same with the layers, pressing Layer Menu and the Add Current Layer List. After that, all the tags and layers used in the asset are assigned correctly to every object and prefab of the asset.
The layers gravityObjects, Armor Surface, Point&Click, Dynamic Split Screen, and Transparent Mesh are optional layers that can be removed if you don't use the optional systems associated with them.
How to create a Generic Character in Game Kit Controller
Search for AI Main Template Prefab and drag it into your scene. Next, go to Game Kit Controller Menu / Generic Models / Add new generic model to controller.
Fill in the name of your new AI and drag its generic model to your scene, then drag it from there to the generic model slot in the wizard.
Select the generic character's avatar, then search your project for Generic Model Animator Template duplicate and rename it, and put it in whatever folder you want.
Drag it into the animator slot to assign it and check the Character Is AI box. Then click Create.
Now go to your AI Player Controller gameObject and expand Other AI Systems. Click on Custom Character Controller Manager.
Check the box Start Game with Custom Character Type in the name that you used in the wizard for your character Scroll to the bottom and click "Enable Current Generic Model"
Now search for the animator controller you duplicated and double click on it to open it. Double click on Locomotion then double click on Grounded and then double click Locomotion again. Select Locomotion Tree and drag your animations to the slots on the right side.
To manage the player’s weapons, go to Player Controller gameObject, and to the inspector Player Weapons Manager.
How to adjust weapons for the the Quick Draw Weapon Action
In the third-person view, there is an option on weapons that allows making a quick draw of the weapon placing it directly on the dominant player’s hand. There is also an option to carry a weapon on the player’s dominant hand when he is not aiming, without IK.
For both options, it is necessary to adjust the position of the weapon on the player’s dominant hand, since every model has a different bone orientation, this needs to be done manually if you use any of the above options (there are a few weapons using these options by default, like the shotgun, laser miner, double shotgun, homing missiles, spear launcher, and laser shooter).
This is a very quick and easy step, with the next steps:
Select the weapon that you want to adjust in the hierarchy, open the IK Weapon System inspector and press the button Show Element Settings:
Press the button Show Third Person Settings and Show Single Weapon Settings. ● The option to use the quick draw weapon is in Quick Draw Settings:
And the option to carry a weapon on the player’s dominant hand while not aiming is in
This is also where the hand position is adjusted to place the weapon on it while not aiming it
To adjust the position, press play, draw the weapon which you are adjusting, aim the weapon and then stop aiming. You may see that the weapon is placed in an incorrect position and rotation when the player draws the weapon. Don’t worry, this is why these steps are being done:
Without keeping the weapon, press the button Copy Weapon Position In Hand
Stop the game and press the button Paste Weapon Position In Hand
And that is it, the weapon now will be placed properly on player’s hand when the quick draw action is enabled on that weapon, looking like this when the player draws that weapon with the position adjusted:
The quick draw can be also used without deactivating the IK system on player’s arms, like for example, the double shotgun, which by default is configured like that:
This weapon has the option to make a quick draw enabled and deactivate IK option disabled, so the weapon is first placed in the player’s dominant hand and then moved to a walk position, like in the capture above.
For this, set to false the field Deactivate IK If Not Aiming, located in the same part that is has been used for this explanation:
In this document, you can easily find out where exactly in GKC you’ll find a particular feature. Each feature is described with different keywords but we encourage keeping the words you use to search a feature to a minimum.
Each feature will have its full path written out, but please remember the following formatting as it will help you understand where exactly inside GKC you can find it:
Path GameObject Component [Button] {Section Title} Feature
The first Tip is shown in full so you can understand where to go, the rest are more direct.
Displays a small white dot in the middle of the screen at all times.
LOCATION
Player And Game Management - Player 1 - Character - Player Camera - Player Camera - [Settings] - {Use Camera Reticle Settings} - Update Reticle Active State
GameObject (on which the feature is stored):
Component (in which you’ll find the feature):
[Button] (if the feature only becomes visible after pressing a button):
{Section Title} (is useful sometimes for navigation inside crowded gameObject Components):
Feature (the actual feature):
While it is possible to simply hide the camera reticle in the following menu.
LOCATION
Player And Game Management - Player 1 - HUD Elements - HUD and Menus - HUD - Player Info - Health, Energy, Weapons - Main Camera Reticle
It is NOT actually recommended to deactivate the reticle in this manner.
This will only deactivate the reticle at the beginning of the runtime, however, there are several features that might bring back the reticle when used.
For example, after using an access panel. Therefore, do not deactivate the reticle UI component, but its feature instead.
Defines the index number of the scene that is loaded when clicking Exit to Home on the pause menu.
LOCATION
Player And Game Management - Player 1 - Character - Menu Pause - Scene Number for Home Menu
When pressing Z, a slow-motion mode is entered until you press Z again.
LOCATION
Player And Game Management - Player 1 - Character - Time Bullet - Time Bullet By Input Enabled
Defines which layers GKC will recognize as walkable ground.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - {Ground Detection Settings} - Layer
If your character is still walking on water, make sure you set the most parent gameObject of your water to a layer that you excluded here. If prompted, you might have to apply the layer to all children as well.
Sometimes when doing changes to the water, you might have to repeat this step. This behavior has been observed with Gaia for example.
Speeds the walking up over time.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - {Walk/Run/Sprint Settings} - Increase Walk Speed Enabled
Adds an extra camera shake to the player when running.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - {Sprint Settings} - Shake Camera On Sprint Third Person
Used in order to hide objects that are not supposed to be visible in first person mode.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - [Advanced] - {Character Mesh Settings} - [Show/Hide EXTRACHARACTERMESHGAMEOBJECT]
Add as many slots to the list as needed and drag the game objects in here that you don’t want to see in the first person (for example eyelashes, hair, pants, shirt, shoes, etc)
Allows the player to do double jumps by pressing the spacebar repeatedly.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - [Advanced] - {Jump Settings} - Enabled Double Jump
Defines how long you can fall before taking damage when hitting the ground.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - [Advanced] - {Fall Damage Settings}
Play a sound when the player receives fall damage (for example “ouch”).
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - [Advanced] - {Fall Damage Settings} - {Event On Fall Damage}
Add a new event and drag your gameObject with the attached audio component in here. If you have multiple different audio files that you’d like to be played randomly when taking damage, you can use the script below and call it RandomInjury, attach it to a gameObject, and add your different audio clips to the list.
Then, drag the gameObject into the Event On Fall Damage list and set it to Randominjury.Injurysound
Displays a blue circle underneath the player when jumping.
LOCATION
Player And Game Management - Player 1 - Character - Player Controller - Player Controller - [Advanced] - {Land Mark Settings} - Use Land Mark
Creates visible footprints on the ground that fades away slowly.
Change the number of items that can be carried in the inventory.
You can also change the number of inventory slots here using Inventory Slots Amount.
Displays a spinning preview of an item when picking it up and before adding it to the inventory.
Configuration for the items available in the inventory and on the player at the start of the game.
Use this list to add or remove items to your inventory list that will be available at runtime.
Additionally, you can choose whether or not items are equipped.
If you want to create new items that could be added to your inventory or picked up in the game, use the Main Inventory Manager outside the Player And Game Management instead.
Then, you can use the Initial Inventory List if you want the items to be available in the inventory at the start of the game.
If you just started with GKC and want to remove all the weapons after creating the player, remove or disable them here, don’t disable them in the player hierarchy.
Used in order to switch between melee, combat, weapon, powers, etc.
Don’t delete players mode, instead just open each player mode individually and untick Mode Enabled.
There, you also have an option to Activate Player Mode Events and Deactivate Player Mode Events.
You can use this section to unlock additional features, for example, you can use icons instead of text to indicate the current player mode on screen.
To do the above, just add UI components to your HUD, for example under Player And Game Management - Player 1 - HUD Elements - HUD and Menus - HUD - Player Info - Player Mode and disable the Text and the Current Player Mode Text.
Then, use Activate Player Mode Events and Deactivate Player Mode Events in the Player Modes settings to activate and deactivate them.
Displays a number of squares at the bottom of the screen with weapons inside.
You can use the number key on the keyboard in order to switch between different weapons easily without having to equip/unequip them in the inventory.
If you disable this, you might also want to disable Show Quick Access Slot Selected Icon, otherwise, a white line will appear on the screen when switching to a weapon.
Allows a player to jump out of the water.
Applies a blue blur to the camera when the player is underwater.
You might want to disable this feature if you have an underwater effect generated by a third-party application such as Gaia, etc.
Displays a red cross or x on screen when receiving damage.
Displays the amount of damage you've received in the form of a floating number that displays around the player.
If you play your game and GKC is not reacting to your keyboard inputs, check if any external input devices are connected to the PC (for example a controller, a tablet, etc.). If you unplug it and restart the game and it now the controls work, you can follow this step.
Some features cannot simply be disabled, instead, you have to disable the keys that trigger these features. Some of the items in the list below might have an option to be disabled, but as of my current knowledge, they can only be deactivated by disabling the input key
To disable the following keys navigate to:
/-Key (forward slash): Player Controller - Show/Hide Axes - Simple Kick
[-Key (left bracket): Player Controller - Show/Hide Axes - Activate Ragdoll in Runtime
CTRL-Key (left control): Player Camera - Show/Hide Axes - Move Away Camera
#-Key (quote, hash): Player Camera - Show/Hide Axes - Enable-Disable Camera Rotation
Shift-Key (right shift): Player Weapons - Show/Hide Axes - Edit Weapon Attachments
Alt-Key (left alt): Player Weapons - Show/Hide Axes - Weapon Melee Attack
Tip: To find out which feature is assigned to which key, you can go to.
Now you can see the full available list of keys and their respective features. In order to search for a specific key, use the dropdown “Action Key To Filter” and press the button: [Show Input Actions Keys By Filter].
Defines the name of the current level, for example in save files.
By default, your player faces North when going into play mode (North is in the direction of the blue Z editor axis) with the camera also facing North.
If you want your player AND camera to face a different direction, use Set Initial Position. Don’t rotate the Player Controller gameObject, because it will only rotate your player but not your camera.
Disable the UI panel in the bottom left corner stating things like fire/draw weapon, wheel menu, draw/holster weapon, attachments, etc.
Disable head bob or change the strength of individual head bobs based on camera state.
Press [Show/Hide BOBSTATELIST] to change the intensity of the head bob per camera state.
Below is a list of the original settings (left) versus a bit less intense ones (right)
Displays a band with a compass at the top of the screen.
You could also disable the compass under Player And Game Management - Player 1 - HUD Elements - HUD and Menus - HUD - Map - Compass Window however, this would only hide the UI component at runtime. If you want to completely disable UI components and never use them, it’s always better to disable their feature on their respective gameObject inside the Character hierarchy, rather than in the HUD Elements hierarchy.
Displays a weapon info panel (HUD) in the top right corner with the current ammo amount and a weapon thumbnail.
Repeat this on every weapon used in your game
Displays a HUD right on the weapon with the current ammo amount.
Note: Repeat this on every weapon used in your game
Defines how much damage a weapon projectile generates on the enemy.
Another feature in this section is called Projectiles Per Shot. You might want to change this in parallel to the Projectile Damage, as the two factors will be multiplied.
Some weapons (for example Assault Rifle) display a visible light beam.
Note: Disable the gameObjects in here as needed
Allows the player to jump off a ledge.
Alternatively, you can also simply lower the Jump Force When Hold Ledge in here if you just want to reduce the jump height
Allows a player to walk and run on vertical surfaces.
Displays a Dpad UI component on the screen.
This will only disable the UI of the abilities Dpad, not the accessibility of the actual features. You can still use the arrow keys on your keyboard to make use of the abilities themselves. To switch the abilities off completely, disable Ability List Manager Enabled in the same gameObject component.
Whilst you could simply disable the Dpad UI element under Player And Game Management - Player 1 - HUD Elements - HUD and Menus - HUD - Player Info - Health, Energy, Weapons, and More, I recommend disabling its feature instead (as described above).
Allows the player to go undetected by enemy AI.
Displays an objective log. U-Key.
Displays a travel station UI menu.
Displays an experience system UI.
Rotates the camera by a set amount of degrees (180 by default).
Activates the scanner system.
How to Create a New Melee Weapon for your character with the Wizard.
Drop the weapon mesh on the scene and make sure to remove any collider on it and also check that the static field is false on the object.
Create a new transform inside the weapon and move it out of it, reset the rotation of the object and place the mesh inside, so you can center the weapon mesh on the center of the new parent.
Remember to set the setting global on the unity top bar setting for the step, so you can see the actual pivot position of the objects.
Open the menu to create a new melee weapon on Game Kit Controller bar settings on the top side of the Unity, and drop the new object there.
Enable the option to create inventory info, set a unique name for the weapon, set a new image and press Create Object button.
Select the weapon type that is closer to the type of weapon that you want to use like a sword, axe, bow, etc.… so it will have similar settings to it.
Enable the option to create inventory info, set a unique name for that weapon, set a new image and press Create Object button.
Once created, you can search it on the search tool of the project window, and drop the physical object in the scene, to adjust some elements on it.
You can adjust the box collider of the weapon object along with adjusting the weapon mesh, so its handle is centered on the pivot of the weapon, to be carried properly.
With that, the weapon is ready to use, in this example, the weapon is placed in the mount point of the hand, so in most cases, it won’t need many adjustments.
But each weapon can be adjusted to each character, for this, go to the melee weapon system and use the melee weapon adjust tool.
First, enable the edit weapon to transform values in-game and the show gizmo option then uses the gizmo to adjust rotation/position in place and press the Copy Transform Values button.
Once that is done, stop the game and press the Paste Transform values button. Now, play the scene and try, the weapon should adjust as you configured now.
Same as carrying on hand, the sheathed weapon position/rotation can be adjusted. Sheath the weapon (Using the Y key by default) and follow the same steps as before.
The process is the same, adjusting the gizmo of the weapon on the character so it is carried there when is not in the player's hands, so adjust, copy, stop the game, and paste.
And all done after that, the weapon is also stored in the player’s inventory.
You can also search the weapon inventory object instead, using the search tool on the project window.
Just like before, you can adjust the collider of the inventory object, to adjust it to the size of the weapon and apply the settings to the prefab (remember to apply the settings in the previous one too).
If the player spine doesn’t rotate correctly when you move the mouse up and down in aim mode in third person, the cause is due to the spine orientation in the model.
For example, in this model, the local Y axis of this model spine, is the Y axis, which can be different in every model.
To fix this, go to the Upper Body Rotation System inspector in the gameObject Player Controller and configure the correct values in the field Spine Up Vector. It needs to be the same up transform orientation of the transform assigned in the field Spine Transform (mixamorig: Spine in this example). In this case, the value is (0,1,0) instead of (0,0,1) which is the default value.
In the default model of GKC, its spine orientation is Z for the local Y axis.
And the value used for this is (0,0,1).
This system allows to configure additional characters in the game, setting them as AI which follows the player and can receive orders, like any regular friend AI would do, but in this case, the player can switch the control of these characters, setting the previous controller as AI and ther previous AI as the new controller used by the player. Any number of characters can be configured from 1 to any amount, so this can be used to make games similar to resident evil revelations 2, combining the gameplay with characters with different abilities who need to work together to keep moving in the game.
To configure this, it is the same steps as in the local multiplayer, so check that part of the doc to add 1 or any extra amount of characters.
Once you have done that, in the same player characters manager component, set the field Set Current Character To Control And AI At Start as true and in the field Current Character To Control Name, write the name of the character which will be used as the default player, setting the rest as
AI.
Once the game starts, you can switch between characters. By default, the key to change between characters is . (you can customize these actions keys in the input manager at any moment).
The player’s upper body rotation can be configured for aim mode in Third Person. This is made in the inspector Upper Body Rotation System in the Player Controller gameObject, allowing to configure how fast the rotations are done and the clamp values used for the spine rotation. The object to follow is the actual transform followed for the player’s torso, which is inside the main camera, so you can move it up or down to adjust the orientation when the player aims.
In this case, you configure a new model, and something like this happens:
The cause is that the spine bones are not correctly configured in the Upper Body Rotation System, in the gameObject Player Controller, due to the skeleton hierarchy is slightly different in this case. In the example above, the system has taken the hips as the first bone, this is incorrect.
But you only need to set the correct bones. To do this go to the inspector and make sure to place the bones which belong to the spine and the chest, like this:
But if this happens, you need to take another step, which is to move the Player Elements gameObject from its current hierarchy position to inside the Chest transform configured in the inspector, in this case, the Spine2.
Like this, the player's weapon should move correctly, rotating the player’s upper body and without any issue.
In update 2.9, local multiplayer has been added, with the split-screen system as the current way to configure the cameras. This local multiplayer is in the beta state on 2.9 and will be complete in 3.0. But all the systems work properly without issues or errors, just need some extra additions and checks, like allowing to configure the player's in-game.
For now, the players can only be configured in editor time. For this, follow these steps:
Go to the gameObject called Player and Menu Management and to the inspector Player Characters Manager.
There, in the field Current Number Of Players, configure the number of players to use (for now using only from 1 to 4).
In this example, let's just use 2. After that, in Camera State To Use, select the screen camera configuration for the split-screen. For 2 players, there are different options like full screen with left and right side with every player, vertical, with a player on top and the other on the bottom, etc…
You can configure new camera distributions on the Camera States List, which configures the amount of main cameras (one per player) and the X, Y, W, and H values of every camera on the screen, setting these values for new players added:
After that, press these buttons in the next order: Configure Players, Set Camera configuration, Set Players ID, and Assign Map System On Map Creator. This will add the new players configured in the amount above, configure the split-screen cameras, set the player's ID to manage input for everyone of them, and add them to the main map system manager.
Here you can see the new player added along the previous one:
You can select another type of camera setting, just by selecting a new one in the field Camera State to Use and pressing the button Set Camera Configuration again. Here are the same players in vertical:
You can also remove players by selecting a lower amount in the field Current Number of Players and pressing the above buttons in the same order (and make sure to select the Camera State To Use according to the number of players in the scene). So you can return to having just one player or add more.
In the hierarchy, you can see how the new players are added inside the main parent:
By default, all players are controlled with gamepad, so you will need the same amount of gamepads as players to play with them. There is an option to allow one player to use the keyboard. For this, go to any of the players to the gameObject called Player Controller, and in the inspector Player Input Manager set to true the field Use Only Keyboard.
After that, return to Player Character Manager and press Set Players ID button again.
Now if you go back to Player Controller gameObject and select the inspector Player Controller, you can see that the Player ID is 0:
When usually would 1. This is to make the system to know that this player won’t use a gamepad but the keyboard. Follow the same steps to configure the use of gamepad again (set as false the field Use Only Keyboard and press the button Set Players ID again).
This system allows to configure the whole mission system and is used to set some settings automatically on it.
For this, go to the upper toolbar of unity, select Game Kit Controller->Main Managers->Add Main Mission Manager.
Then, this system is placed on the level, which is the main mission manager, and it contains a list of all the station systems in each level. These station systems can be used as a physical mission board or just an invisible to configure different missions which are maybe activate by dialog or trigger.
Each station has a list of missions, which are the one which contains the missions to achieve, task, and rewards, and events to activate.
Also, it allows to place different mission elements on the level with just a click.
One of them is the Mission Station, which can be used as a physical mission board or just an invisible to configure different missions which are maybe activate by dialog or trigger.
Each station has a list of missions, which are the one which contains the missions to achieve, task, and rewards and events to activate.
Other element is the Mission System. which is the component where each mission itself is configured and managed.
And finally the Character Mission System, used to place missions on NPC, giving them to the player directly when the player uses the interaction button, showing the mission panel on characters. To trigger missions with dialog, other way (which will be explained later in videos and on this doc) is used, and which you can already see in the advanced mission demo.
The process to configure missions in the main mission manager is the next:
Configure all the missions that you need in the Objective Event System components:
Them, in the Station System or the Empty Station System (Objective Station System component), assign these missions according to where you want them to be found by the player, like a mission board, with a character, by trigger, etc...so you assign these missions to one Objective Station System component or other.
Then, go to the Main Mission Manager (Objective Manager component), assign the Scene number of the level assigned in the unity Build Settings panel and press the button Get All Station Systems On The Level And Assign Info. You will see how all the Station System appear on the
Objective Station System List.
With it, all Objective Event System (each mission configured), gets a Mission Id and the same Mission Scene value than in the main manager.
This also allows the system to save the info of the missions found by the player, with those already complete and those to finish yet.
Add a new action on the input and configure the event to activate the animation action by going clicking on the root of the prefab (Player and Game Management), then the Input Manager component.
Scroll down to the section Multi-Input List and open the Multi Axes List menu.
Then open Player Controller in the Multi-Input List and select Add Action to add a new one. In this tutorial, we’ll be creating the action, Simple Kick. You can also put a Keyboard and/or Joystick input to activate the action here.
Next, navigate to the Player Controller game object on the player character and scroll down to the Player Input Manager.
Then scroll down to Multi Axes List and select the Player Controller section as we did on the Player and Game Management component. Click Add Action as before, except now on the Axe dropdown, you will see the Simple Kick Action we made. Select that. Set the Button Press Type to Get Key Down to have it execute when the input key is pressed down.
Click the plus under Button Event to add a new Event and drag the Player Action System prefab for the hierarchy into the field to assign it.
Select No Function, go to playerActionSystem and select activateCustomAction (string). For the string enter in our new action, Simple Kick.
Next, we’ll configure the action values to play a specific animation using its name and duration as main parameters. First, we’ll go back to the Player Action System game object and add a new game object named Simple Kick that will hold our settings for Simple Kick.
Add a game object under Player Action System and add the Action System component to it.
Scroll down to the Action Info List and click Add Action. The Name and Action Name are our action, Simple Kick. For this example, we’ll enable Pause Player Actions Input so that other inputs are recognized while the action is active. Then we’ll enable Resume Player After Action so that the player regains control after the Action is finished.
Now we need to add an animation to our action. Open the Animator window and make sure you have the Base Layer selected. Click the state machine New Actions, right-click the canvas and add a new State Machine. Name it Simple Kick.
Open the new state machine we just created and add a New State. This will be named, you guessed it, Simple Kick. Add a kicking animation to the Motion field. There’s one included in the Mixamo Animation package, Sword and Shield Kick. Note the Animation Time of your kick animation, we’ll be using that later.
Add a transition from Simple Kick to the state Main Movement>Grounded>Grounded. Select the transition and uncheck Has Exit Time. Under Conditions add the Action Active parameter and set it to false.
Navigate to the Custom Action State Info Settings and open the Custom Action State Info List.
Add a new state by increasing the Size by one. There are 46 in this example, so we’ll increase it to 47. The name is our action, Simple Kick, like the rest of the fields. For Main Action System, we’ll drag our Simple Kick game object that we just added to assign it.
Go back to the Simple Kick action we added under Player Action System, and under Action Main Settings, set the Animation Duration to our kick animation. In our example, it’s 1.2. Next check Action Uses Movement.
That’s it! The input will now call this new custom action we made, taking care of pausing and resuming the rest of the states, input, and actions of the character.
Now, let’s add some interaction and flourish to our kick. We’ll configure a component to push objects in front of the player that is kicked using the events options of the action. Including any needed delays.
Under the Player Controller game object, select the Push Objects on Running Slide game object and duplicate it. We’ll rename it to Simple Kick Push.
Return to the Simple Kick game object under the Player Action System. Under Event Info List click Add Event. In Element 0, we’ll set the Delay to Activate to 0.5. Add a new event in Event To Use and drag the Simple Kick Push game object into our field. Select the Function pushObjectsPower > setPowerEnabledState (bool) and check it.
Add another Event to the Event Info List. Element 1 will have a Delay to Activate of 1. Drag over the Simple Kick Push again into the field. Select the same function as before, setPowerEnabledState, and leave it unchecked.
That’s it! Happy Kicking!
This system allows to connect different Scenes between each other ingame, so the player can change from one Scene to another using some element of the level, like a button to press, a
trigger to enter, an event, like pick an object, using a fast travel station, etc…
Think about this system like in borderlands games, where the player reaches the limit of the level, with some kind of gate where he press the interaction button, and he moves to another new level, being a different zone. And of course, the player can return to the previous one, using the gate where he appears in the zone.
To configure this Scene manager, go to the upper tool bar of unity, select Game Kit
Controller->Main Managers->Add Main Level Manager Ingame.
In this menu, you can place the different types of gates to change of Scene, according to what you need. The current types are by Button, so the player can use the interaction button when he is on the range of the gate to trigger the change of level.
By event, this can be triggered by any object with an event attached, for example, picking ammo from the ground or a weapon or an inventory object can activate the change of Scene.
By trigger, so basically, when the player enters inside a trigger, it will change of Scene automatically.
And also, a travel station, a physical trave station which can be placed anywhere on the level and will allow the player to select a Scene to travel (these scenes can be unlocked once the player reaches the travel station of each Scene or by default, have unlocked all the Scene available to travel, according to your type of game).
Once you place one of these changes of Scene objects (from now, we will call this object CSO) , you have to go to the component Level Manager ingame. This component is used to configure the current ID of this CSO (Level Manager ID) and the Scene number to travel (Scene Number To Load), and inside of that Scene, the ID of the CSO to use as a place to appear (Level Manager ID to Load).
It is like an address, and you can have one or many CSO in each Scene, so each one has its own direction.
You can see an example of this in the Scenes Level Manager Building Scene 1 and 2, where in the first door in the exterior of the building, there is one of these CSO, configured with its ID and the scene and ID to use in that scene, which belongs to the object in the second scene, which has that CSO inside the building, with the ID of destiny.
It is very simple but can be confusing for the first time, so take a look at the exterior and interior of this door.
In the exterior, the Scene Number To Load is the scene which contains the interior of the building. The Level Manager Id is 0, since this is the first CSO of this Scene and Level Manager ID to Load is 0 as well since that other object is the first CSO of the second scene, which has the interior of the building.
In this case, the exterior zone is the Scene number 46 and the interior of the building is the Scene number 47.
In the Scene number 47, you can see the settings of the other component, which is in this case, is going to travel to the Scene 46. Its Level Manager is 0, which is the address configured in the other scene and its Level Manager ID to Load is 0 too, since this will travel to the above CSO.
In the component Level Manager Ingame you can see the field Spawn Player Position Transform which is the reference position and rotation used to place the player on the level once he changes of Scene, so each CSO can be considered as “connected” to other CSO configured in another Scene.
You can see the same example in the second door of this demo example, but in this case, the ID is 1 instead of 0 since this is the second CSO on the level, so the interior points to the exterior object and vice versa.
The travel station work in the same way. Once you have all you Scenes on your game, you can configure the component Travel Station System, with the list of Scenes info, each one with the Scene number to travel and the CSO ID to go. For example, if a Scene has three gates, you select one of them as the default position of that zone to appear when the player travels to that Scene (this also works the same in borderlands, having a fixed zone to appear in one zone, even if that zone has many gates).
In this case, you can see how the station has 2 elements, one per scene, pointing to the first door of the Scene, with the ID 0, so if the player travels to the Scene 1 it will appear in the exterior, at the side of the door and it he travels to the Scene 2, it will appear inside the building, at the side of the door too.
Here you can see also in the Build Settings, how the Scene numbers are 46 and 47 for this couple of examples, being each one the exterior and the interior zones of this place.
In order to try the default demo scenes for the scene manager, you can configure the build settings to set the scene index like in the image below, with the same index for each scene:
Using for this the scenes located on this folder:
Once that is configured, open the first scene and play there with entering into the house and returning outside and walking also outside of the perimeter through the big red door behind the player.