🎨
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
  • Creating A Module Mount
  • Specifying Mountable Types
  • Adding Module Prefabs
  • Cycling Modules at a Module Mount
  • Checking Module Compatibility
  • Adding/Removing Modules
  • Accessing Added Modules
  • Mounting/Unmounting Modules
  • Accessing The Currently Mounted Module

Was this helpful?

  1. Vehicle Framework
  2. Modules

Module Mounts

PreviousModulesNextModules

Last updated 7 months ago

Was this helpful?

Module Mounts are places on a vehicle where modules are mounted onto a vehicle. A vehicle can have any number of Module Mounts.

Any number of modules can be added to a module mount, but only one may be mounted at any time. This means that you can add multiple modules to a single mount, and cycle between them during game play.

Creating A Module Mount

To create a module mount on a vehicle, add a new game object as a child of the vehicle, rename it to something relevant, and add a Module Mount component. Set the local position and rotation according to how you would like the module to be oriented when it is added to the vehicle.

Specifying Mountable Types

Let's say you want to add a module mount to a vehicle that can only be used to load gun weapons.

  1. Create a for gun weapons.

  2. Drag the Module Type you created in step 1 into the Mountable Types list in the inspector of the Module Mount component.

  3. Make sure all the gun weapon modules have their 'Module Type' set to the Module Type you created, in the inspector of their Module components.

Adding Module Prefabs

Let's say you have some module prefabs that you've created, and you want them all to be added to a module mount.

Drag all the prefabs to the Default Module Prefabs list in the inspector of the Module Mount component, and they will be created there when the scene starts.

Cycling Modules at a Module Mount

  1. Go to the Player and add a PlayerInput_InputSystem_ModuleMountControls component in its hierarchy.

  2. Go to the Module Mount you want to control and make sure its ID is the same as the 'Module Mount ID' value in the inspector of the PlayerInput_InputSystem_ModuleMountControls component from step 1.

  3. Now play the game. You can cycle forward and back through the modules at that module mount, when the player is controlling that vehicle. Open the General Input System asset to see/modify the inputs.

Alternatively, if you'd like to cycle modules at a module mount in our own code, use this code:

// Mount the next module
myModuleMount.Cycle(true);

// Mount the previous module
myModuleMount.Cycle(false);

Checking Module Compatibility

To check if a module is compatible with a module mount in code, use the following code:

// Check if a module is compatible with the module mount
if (myModuleMount.IsCompatible(someModule))
{
    // Some code
}

Adding/Removing Modules

A module is added to a module mount when it is placed there and ready to be mounted. But a module that is added still needs to be mounted - remember that while many modules can be added to a module mount, only one of them can be mounted.

To add or remove modules from a module mount during game play, use the following code:

// Add a module
myModuleMount.AddModule(someModule);

// Remove a module
myModuleMount.RemoveModule(someModule);

// Remove all modules from the module mount
myModuleMount.RemoveAllModules();

Accessing Added Modules

To access the modules added to a module mount, you can access the Modules list from a reference to the Module Mount component with the following code:

// Get a list of modules at a module mount
List<Module> modules = myModuleMount.Modules;

Mounting/Unmounting Modules

To mount the first module that is added to the module mount when the scene starts, check the Mount First Available Module At Start checkbox in the inspector of the Module Mount component.

To mount or unmount modules during game play, use the following code:

// Mount a module by direct module reference
myModuleMount.MountModule(someModule);

// Mount a module by the module's ID (string)
myModuleMount.MountModule(someModuleID);

// Mount a module by its index in the Modules list (int)
myModuleMount.MountModule(someIndex);

// Unmount the currently mounted module
myModuleMount.UnmountActiveModule();

Accessing The Currently Mounted Module

To access the module that is currently mounted at a module mount, use the following code:

// Get the currently mounted module - if none mounted, the result will be null
Module mountedModule = myModuleMount.MountedModule();

Module Type