Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The main player prefab is called “Player And Game Management” and it can be found in the prefabs folder called “Player Controller”.
It is composed of different elements and here you can see each one of the most important in its hierarchy:
In this level of the hierarchy is where the main managers in the game are located, in the Main
Manager Administrator in certain (which is explained a few pages above, on the MAIN MANAGER ADMINISTRATOR section)
How to check and filter input Actions and Keys/Gamepad Used for It
The custom system of input on GKC has an option that allows showing all the input actions configured so far on the settings, including showing the name of each action, its category, and the input key used for it, including keyboard and gamepad as well.
This allows you to see better all the actions that your current game uses and the free keys that haven’t been assigned yet.
To see this, go to the Input Manager component in the main player’s prefab parent:
And in the bottom section, you will find the button Show Current Input Action List Settings.
Press and select the input actions that you want to see, gamepad or keyboard and press the button for either of both options to show all the input configured:
This will show each category of input, each action input, and the keyboard key and/or gamepad button on each action:
You can also filter the actions to show by keyboard key or gamepad button in the buttons below, by selecting a keyboard key or a gamepad button on the fields Action Key To Filter and Joystick Button To Filter.
Here's an example of searching for key “N” on the keyboard:
And here searching for button “A” on the gamepad:
You can also clear the info shown in the button Clear Keys Input Actions List Text and close this panel in the Hide Current Input Action List Settings.
Configure the Input Manager for various Vehicles.
The customization of input on vehicles is almost exact to the process for the settings of input in the Player Input Manager component in the player.
First of all, you basically need to add or configure the input actions on the Input Manager component of GKC.
It is recommended to add a new input action category for each new vehicle if the new one that you want to add has a different input or special actions not present in the previous one. Of course, you can add the new actions in a previous category of vehicle input as well.
Once you have the new actions or the new category added to configure a new vehicle control, go to any of the GKC vehicles and in the main object itself, go to the component called Input Action Manager, more specifically, in the Multi Axes List.
If you added a new input category in Input Manager or just added or modified some input actions, press the button “Update Input List”:
Now, in the field “Axes” below that button, select the input category for this vehicle, in the case you added a new one. You will see a list with all the input categories configured in Input Manager, so select one of them. If you just added or modified input actions, no need to select a different input category in that field:
Now, inside Axes, press the button Update Input List.
And now, select each input that is on this list, and remove, edit or add new input actions based on what you need. On each input action, you only need to select the input action name on the field “Axes” according to the name of the input from Input Manager, and the type of press to use to activate this action (down, hold. or up).
Finally, configure or add a new event in the Button Event, drop the object with the component that has the function to activate, and configure the function itself on the event field. You can set as many events as you need on each input action:
Don’t forget to set a name for the action in the field “Action Name” as that name will be shown in the in-game control panel for that vehicle (it can be opened with N by default, and it can be disabled as well, to not be used).
And the same applies to each of the rest of the actions. Make sure to press the buttons to update the input action list if you add/remove/modify the input action on the Input Manager of GKC for the vehicle that you are going to use.
The input can be edited in-game at any moment, allowing to change for example the key used for jump.
For this, a menu is configured for this system, and inside this menu, multiple panels for each group of actions and different actions buttons are created for each action in those groups.
This by default is made at the start, instantiating these elements in that moment, but these elements can be configured and instantiated in the editor, before starting the game, to avoid those instantiations at the start.
To configure this, follow these steps:
Go to Input Manager inspector:
Go to the section Rebing Input Menu Options:
And set the number of panels and actions buttons inside each panel, to use it as a pooling list of elements to be used for the rebind menu, and press the button Instantiate Rebind Menus And Actions Panels:
You can see how these panels and elements are created inside the Edit Input Controls menu.
You can also, destroy these panels to create other amounts or instantiate them at the start with the button Destroy Rebind Menus and Actions Panels.
The options Create Rebind Input Menu With Current Axes will use the current amount of input categories and actions in each category to create the exact amount of panels for the rebind menu, instead of having a pooling list with panels and buttons that maybe will be left as not used due to the actions amount are lower that the amount of these panels.
How to add a Player Action to a New Unity Script
Add a new Axe in the Axes list, by pressing the button Add New Axe or Add Action.
Set the name that you want for that action and a keyboard button.
Declare an inputManager variable type (if the script doesn’t contain it yet), get the main inputManager in the scene, and add the above functions to the script, setting the type of press button and the action that you want to check. In this example you can see it better:
Open the axes list and press the X button to remove the action.
If you have this action in the code, there won’t be any problem if it is not removed from the script, but it won’t trigger any action.
Once you have defined a list of actions and added or remove any action, you will need to save that list. To do this, first, you need to configure the save settings (it is already configured by default, but you can configure it):
Press the button Save Settings.
If you want that the game loads the axes from a file when the game starts, set the option Load File in Load Option. The axes list loaded can be different from the list configured in the inspector.
Also, if you want to use a relative path for the file, just set the option Use Relative Path, set a path in Relative Path, and a file name in Save File Name. For this option, the Load Option needs to be Load File, else the axes used will be configured in the inspector.
Once you have selected the path to save the file, you can save the current axes list configured in the inspector, so it will be loaded when the game starts, using as the default configuration.
There are different options in the Input Scheme Options:
Default - Removes the current axes list and configures it with the controls by default (this is created inside the code, so the default list is always the same, but it can be changed, in the inputManager script, go to the function setToDefault and change the list configured). This function also set the touch buttons.
Save To File - Save the current axes list in a file with the name and path configured previously in the Save Settings.
Load From File - It removes the current axes list and configures it with the controls created in the last save file created.
In the Touch Controls Settings, you can configure both touch joysticks for mobile controls, the sensitivity of them, and the mouse. Also, here is configured the Touch Panel, which contains every touch button used in touch devices.
You can check all the actions in the pause menu by pressing Esc, then selecting Edit Control Input. In that window, you can see all the actions defined in the custom Input Manager. This component is assigned in the gameObject Player And Menu Management.
In the inspector you can add and remove as many groups of actions as needed. These groups are divided into Axes, so the input of the controller can be organized into a separate group from the camera, another group for weapons, powers, menus, vehicles, etc… For this, go to Multi Axes List and open it:
Inside every group, you can add, remove, enable and disable every action and assign a keyboard button, a gamepad button, and a touch button.
Also, you can edit the path to save the current map button, by pressing the button Save Settings. This file will be stored in the persistent path by default or in a relative path to your project folder if you enable the option “Use Relative Path”.
IMPORTANT: if you are making a game for mobile, set the option Use Relative Path to false.
In the options below, you can select the keyboard or touch controls as input when the game starts. Also, in-game, you can switch between these two modes by opening the menu with Escape and pressing the button Switch Controls Type. If you are in this touch controls mode, press Esc and then press Switch Controls Type again to change to keyboard controls. This option can be used in both modes. The label Current Controls shows what current control scheme is currently selected.
For this process, you can either configure a new input action or assign a touch button to an input action already configured.
For this, go to the input manager component (from GKC) and press the button Select Main Touch Button Panel On Editor.
Then, select the panel where you want to add a new touch button, or create a new panel and add the new touch button there. You can enable the touch button panel (and disable the rest of the touch panels, so you can see better the main panel that you are configuring) and place the new button where you need it on the screen, along with customizing its size, texture, color, etc...
Now, press the button Get Touch Button List. You will see that the main touch panel has been disabled again to hide it on the screen until it is used in-game:
From there, in each input action, you can select the category of the touch button panel and the button name. Now that a new button has been added, this will also appear when selecting the category of the touch buttons where this new button has been added (the category is the main panel where the touch button has been added, in the above example, it would be the
Main Controls category, which is the name of the panel itself.
Each panel is like the category for regular controls, weapons, powers, examine devices, use photo mode, etc… so through event options, you can change the current touch control scheme (you have categories, and you can define control schemes, which are combinations of these touch panels) to combine for example regular controls with weapons and similar.
Back to configure the touch button in a specific action, open the Multi Axes List and select the category of input and the action input itself to set the new touch button:
For this example, let’s add a new action and set the new touch button there:
So in the Touch Panel field, you select the category of the touch controls where the new touch button was added and the new touch button itself:
And now, that touch button will activate that input on play mode and in build as well. If you assigned that touch button to a previous action, there are no more extra steps. If you added a new action, you only need to follow the steps in the previous part of this doc to set the action events which that button will trigger in the player input system component, in the player controller gameObject.
You can also check the tutorial video for this process, which you can see here:
If you want to disable any Touch Button at the start of the game, for example for buttons that are only enabled in certain moments (like the button to open a door or use a device), follow these steps:
Open the list of Touch Buttons Disabled At Start.
Press the button Add Button.
Select the action whose touch button you want to disable at the start (the list of actions is dynamic according to the axes currently configured).
Press the X button in any element of the list.
Once you have created an action in the axes list, you can assign a touch button to it:
Go to the Touch Panel gameObject, inside the Canvas component of the player.
Copy and paste any Touch Button inside of the Touch Panel. Also, you can add a new empty object, add a Raw Image component, configure its texture and add a Touch Button Listener. Here's how the button inspector looks:
Also, you have to configure the name of that button with the same name that the action which uses it. For example, if the action is called “Jump”, the touch button needs to be called “Jump” too (this is used in the code to identify better every touch button). Finally, assign that object in the Touch Button element of the action configured.
When a touch button is added, the option Show Touch Button Scale is shown.
You can change the scale of a touch button from the inspector. To do this:
Press the button Show Touch Button Scale.
Select the X and Y scale in the range.
You can also activate the option Width = Height, to set the same value for both sizes.
The mobile joysticks can be configured with different scales and margins, to adjust better to the screen size according to the touch buttons in the screen. For this, follow these steps:
Go to Touch Joysticks Controls gameObject inside the HUD gameOject inside the Canvas.
Select any joystick (right or left) and configure it:
You can configure the size of the pad, if it uses margins to be placed more to the left or the right, up or down, the touch zone, to check if the player touches the joystick or not, the drag distance, if it snaps to finger, if it hides on release if it is shown while pressing, if the joystick behaves like a touchpad and if it changes of color while pressed.
To have a better look at the joystick while it is being configured, use the Scene instead of the Game window for it.
Used for the management of multiple players in the same scene, for the use of local multiplayer and the switch companion AI.
It contains some settings related to the save of info, like the path used for it and the main name for the files along with other minor settings.