🎨
UVC
  • Introduction
  • Installation
    • Installing in New Project
    • Installing in Existing Project - SCK
    • Installing in Existing Project - MCK
  • Space Combat Kit Tour
  • Mech Combat Kit Tour
  • Player Setup
  • Vehicle Framework
    • Game Agents
    • Vehicles
    • Modules
      • Module Mounts
      • Modules
      • Module Types
      • Module Attachments
      • Display Module On UI
      • Module Managers
  • Input
    • General Input
    • Vehicle Input
    • Rewired Integration
  • Player/AI
  • Spaceships
    • Speed UI
    • Space Fighters
    • Capital Ships
  • Mechs
    • Speed UI
  • Vehicle Control Animations
  • Character Enter/Exit
  • Camera
    • Camera Setup
    • Vehicle Setup
    • Secondary Cameras
    • Death Camera
  • Weapons
    • Framework
      • Triggerables System
      • Weapon System
    • Vehicle Setup
      • Vehicle Weapons
      • Cursor Aiming
    • Projectile Weapons
    • Beam Weapons
    • Missile Weapons
    • Resource Handling (Ammo/Heat)
    • Turrets
    • HUD Weapon Info
    • Health Modifier Volumes
  • Radar
    • Radar Setup
    • Target Setup
    • Target Selectors
    • Trackable Types
    • Improving Radar Performance
    • Target Notification
    • Radar Audio
  • Health
    • Health Framework
      • Health
      • Damageable
      • Damage Receiver
      • Health Modifier
      • Health Types
      • Health Modifier Types
      • Surface Types
    • Vehicle Setup
    • Damageable Object Setup
    • Detonators
    • Health Recharge
    • Health UI
    • Energy Shield
    • Damageable Module Linkers
  • HUD
    • HUD Basics
    • HUD Manager Setup
    • Custom HUD Components
    • HUD Module Display
    • Camera View Management
    • HUD Cursor / Reticle
    • Weapon UI
    • Resource Container UI
    • 2D Radar
    • 3D Radar
    • Target Boxes
    • Target Holograms
    • Minimaps
    • HUD Distance Lookup
  • Loadout
  • AI - Space Combat Kit
    • AI Setup
    • AI Spaceship Behaviours
  • AI - Mech Combat Kit
  • Game States
  • Teams
  • Floating Origin
  • Object Pooling
  • Menus
    • Creating Menus
    • Button Controllers
  • Rumbles
  • Rigidbody Characters [WIP]
  • Utilities [WIP]
    • Object Triggers
    • Shadow Caster Doubles
    • Gimbals
    • Game State Post Process Enabler
  • Objectives
  • Resources System
    • Resource Containers
    • Resource Handlers
    • Resource Container Triggers
    • Module/Vehicle Resource Usage
    • UI
  • Cutscenes
  • URP Upgrading
Powered by GitBook
On this page
  • Initialization
  • Input Update Conditions
  • Enable/Disable Input
  • Adding Your Input Code

Was this helpful?

  1. Input

General Input

General input is for handling input that is not specific to a vehicle, such as game menu navigation, and can be placed anywhere in the scene.

To create your own general input script, create a new script that extends the General Input base class:

using VSX.UniversalVehicleCombat;

// Custom general input script 
public class MyGeneralInput : GeneralInput {}

Initialization

When an input script is initialized, it means it has access to all the components it needs to control and is ready to run.

General Input scripts are initialized by default, but you can override the Initialize function in your own scripts to run your own checks before allowing it to initialize.

// Override the Initialize function
protected override bool Initialize()
{
    // Some code
}

// Check if input script is initialized
if (myGeneralInputScript.Initialized)
{
    // Some code
}

// Do something if initialization fails
protected override void OnInitializationFailed()
{
    // Some code
}

Input Update Conditions

If you want to run a General Input script only when certain conditions are met, you can add values to the Input Update Conditions list in the inspector. These are similar to Unity Events, and you can add boolean functions or getters from any script that must return True for the input to work.

Enable/Disable Input

You can enable or disable an input script at any time, or check if it is enabled:

// Enable input
myGeneralInputScript.EnableInput();

// Disable input
myGeneralInputScript.DisableInput();

// Check if the input is enabled
if (myGeneralInputScript.InputEnabled)
{
    // Some code
}

Adding Your Input Code

To add your input code to a General Input script, you can override the Input Update function, which is only called when the input script is initialized and enabled and the input update conditions are met.

// Override input
protected override void InputUpdate()
{
    // Add your input code
}

// Do something when input update fails (e.g. cancel a running operation)
protected override void OnInputUpdateFailed()
{
    // Do something
}
PreviousInputNextVehicle Input

Last updated 2 years ago

Was this helpful?