JU TPS Documentation
  • 🤩Welcome to JU TPS
  • 😄Quick Start
    • How to start a new scene
    • How to create a JU Character / Reskin Default Character / Setup New Characters
      • Ragdoll
      • Damageable Body
      • Physical Damage
      • Body Leaning Setup
      • Taking Damage / Healing
      • Footstep System
      • Resizable Capsule Collider
    • 📦 Addon Installer
  • 🎮Game Development
    • Game Styles
      • Third Person Shooter Style
      • First Person Shooter Style
      • Top Down Style
      • 2.5D Sidescroller Style
      • ⚠️Important Info About Cross-Plataform
    • Controls / Inputs
      • JU Input Manager
      • Input Events
    • How to create a Mobile Game with JU TPS
      • Mobile Inputs
    • How to load scene
      • Scene Controller
    • How to use Cover System
    • How to use inventory and add items
      • Inventory in UI
      • How to switch between items
      • How to align weapon rotation
    • How to create weapons and items
      • Prevent gun clipping through walls
      • Creating Projectiles/Bullets
    • How to use Dual Wielding System
    • How to use Armor/Cloth System
    • How to use Vehicle System
      • Standard Vehicle Configuration
      • How to create a Car Controller
      • How to create a Motorcycle Controller
      • Vehicle Engine Sounds
      • Coding Custom Wheeled Vehicles
      • How to enter and exit from a vehicle
    • How to use Gravity Switching
    • How to use Actions/Skill and Animation Events
      • JU TPS State Machine Behaviours
      • JUTPSActions Lib Scripting Reference
    • Camera State Trigger
    • How to use Enemies AI
    • How to use Vehicles AI
  • ⚙️Tools, Utils and Tutorials
    • General Tutorials
      • How to do Ragdoll Fall with Input Event
      • How to disable FPS Aim Mode / Scope / Iron Sight Aim
    • Auto Scripts
    • Icon Generator Tool
    • Destructible Objects System
      • Fracture Generator Tool
    • Pixel Quality Scaler
    • Camera Shake
    • Slow Motion
    • Gizmo Drawer
  • ▶️Video Tutorials
    • How to use JU TPS
  • 💬Discord Community
  • ❓Support | Help
  • 📍Roadmap
  • 🔃Change Log
  • 📦Official Addons
Powered by GitBook
On this page
  • Simple Input Detection
  • Functions and Description
  • Custom Inputs
  • Rewrite Functions
  1. Game Development
  2. Controls / Inputs

JU Input Manager

The JU Input Manager helps with input handling and cross-platform operation.

Simple Input Detection

This page will be useful when you want to expand the system, add actions or just detect inputs.

Using the JU Input Manager to detect inputs is simple, inspired by the old input system:

using UnityEngine;

// 1 Step -> Import JUInputSystem
using JUTPS.JUInputSystem;

public class JUInputHandlingTest : MonoBehaviour
{
    void Update()
    {
        // 2 Step -> Check if Jump Button(Space Default) was pressed
        if (JUInput.GetButtonDown(JUInput.Buttons.JumpButton))
        {
            Debug.Log("Pressed Jump");
        }
    }
}

In line 4 the JUInputSystem is imported, in line 11 the check is made if the jump button was pressed, and in line 13 it is an example of action that can be replaced by any other code.

Functions and Description

Function
Summary

float GetAxis(Axis axis)

Returns the value of the deafult axis

bool GetButtonDown(Buttons Button)

Returns the value of the deafult buttons when pressed down

bool GetButton(Buttons Button)

Returns the value of the deafult buttons when pressed

GetButtonUp(Buttons Button)

Returns the value of the deafult buttons when pressed up

bool GetCustomButton(string CustomButtonName)

Returns the value of the custom buttons when pressed

bool GetCustomButtonDown(string CustomButtonName)

Returns the value of the custom buttons when pressed down

bool GetCustomButtonUp(string CustomButtonName)

Returns the value of the custom buttons when pressed up

bool GetCustomTouchButton(string CustomButtonName)

Returns the value of the custom touch buttons when pressed

bool GetCustomTouchButtonDown(string CustomButtonName)

Returns the value of the custom touch buttons when pressed down

bool GetCustomTouchButtonUp(string CustomButtonName)

Returns the value of the custom touch buttons when pressed up

Vector2 GetCustomTouchfieldAxis(string CustomTouchfield)

Returns the value of the custom Touchfield

Vector2 GetCustomVirtualJoystickAxis(string CustomJoystickName)

Returns the value of the custom Joystick

Vector2 GetMousePosition()

Return current mouse position

int GetTouchsLengh()

Returns the number of touches on the screen

InputSystem.Controls.TouchControl[] GetTouches()

Enums
Content

Axis

MoveHorizontal, MoveVertical, RotateHorizontal, RotateVertical

Buttons

ShotButton, AimingButton, JumpButton, RunButton, PunchButton, RollButton, CrouchButton, ProneButton, ReloadButton, PickupButton, EnterVehicleButton, PreviousWeaponButton, NextWeaponButton, OpenInventory

The Enums above are all default JU TPS Inputs that you can easily access with the above functions.

Example: float moveHorizontal = JUInput.GetAxis(JUInput.Axis.MoveHorizontal);

Custom Inputs

In the JU Input Manager you can create custom inputs and call it normally, first create a Custom Input:

And you can call that input like this:

 //Check if Custom Button "SuperPower" was pressed
if (JUInput.GetCustomButtonDown("SuperPower") || JUInput.GetCustomTouchButtonDown("SuperPower"))
{
   Debug.Log("Pressed M");
}

See below all Custom Input Functions:

Functions
Summary

bool GetCustomButton(string CustomButtonName)

Returns the value of the custom Input Button when pressed

bool GetCustomButtonDown(string CustomButtonName)

Returns the value of the custom Input Button when pressed Down

bool GetCustomButtonUp(string CustomButtonName)

Returns the value of the custom Input Button when pressed up

GetCustomTouchButton(string CustomButtonName)

Returns the value of the custom Virtual Button when pressed

GetCustomTouchButtonDown(string CustomButtonName)

Returns the value of the custom Virtual Button when pressed down

bool GetCustomTouchButtonUp(string CustomButtonName)

Returns the value of the custom Virtual Button when pressed up

Vector2 GetCustomTouchfieldAxis(string CustomTouchfield)

Returns the value of the custom Touchfield

Vector2 GetCustomVirtualJoystickAxis(string CustomJoystickName)

Returns the value of the custom Joystick

Rewrite Functions

Functions
Summary

RewriteInputAxis(Axis axis, float AxisValue)

Rewrite the value of a default JU input axis

RewriteInputButtonPressed(Buttons button, bool ButtonValue)

Rewrite the value of a default JU input button

RewriteInputButtonPressedDown(Buttons button, bool ButtonValue)

Rewrite the value of a default JU input button

RewriteInputButtonPressedUp(Buttons button, bool ButtonValue)

Rewrite the value of a default JU input button

PreviousControls / InputsNextInput Events

Last updated 1 year ago

<- With this code this message should appear in the console

Note that the "Custom Button" only works in the Old Input System, if you want to check inputs in the new input system you can use

These functions rewrite the Inputs, it is used by to make the virtual buttons work.

🎮
Input Events Components
Mobile Rig