🚢
Airship
  • Getting Started
    • Welcome to Airship
    • Installing Airship
  • TypeScript
    • Overview
    • AirshipBehaviour
      • Adding Inspector Properties
      • AirshipSingleton
      • Using Component Decorators
      • Accessing Other Components
  • Publishing
    • Publish Game
    • Developer Console
  • Networking
    • Multiplayer
    • Local Server Mode
    • Network Signals
    • Network Functions
    • Network Identity
    • Network Transform
  • Input
    • User Input
      • Actions
      • Keyboard
      • Mouse
    • Proximity Prompts
  • Core Package
    • What is the Core Package?
    • Chat Commands
    • Inventory
    • Spawning Characters
    • Enable / Disable Core Features
  • Physics
    • Physics Settings
    • Physics Layers
  • Platform Services
    • Data Store
      • Locking
    • Cache Store
    • Leaderboards
    • Platform Inventory
    • Server Management
    • Server List
    • Server Transfers
    • Users
    • Parties
    • Matchmaking
    • External Services
  • CHARACTERS
    • Quick Configuration
    • Character Movement System
      • Character Movement Data
      • Character Movement Events
    • Character Camera
      • First Person Camera
      • Simple Usage
      • Camera Structure
      • Default Camera Modes
      • Disabling the Camera System
    • Character Animations
      • Character Blender Animations
      • Character Ragdoll
  • Accessories
    • Accessories Intro
    • Creating Accessories
    • Using Accessories
  • ANIMATIONS
    • Animation Events
  • Optimization
    • Live Game Profiler
    • Reducing Bundle Size
  • Game Settings
    • Game Visibility
  • Other
    • Project Status
    • FAQ
    • DataType Math
    • JS to Luau
    • Tags
    • Terrain
    • AirshipNetworkBehaviour
      • Lifecycle Events
      • ServerRpc
      • ObserversRpc
      • TargetRpc
    • VoxelWorld
      • Voxel World Getting Started
      • Voxel World Tips
      • Prefab Voxels
      • QuarterBlocks
    • Easy Helper Utils
      • Easy Motion
      • Easy Grid Align
      • Easy Look At
      • Easy Shake
      • Easy Destroy
Powered by GitBook
On this page
  1. Core Package

Enable / Disable Core Features

To easily configure your project you can add the CharacterConfigSetup component to any game object in your scene.

PreviousSpawning CharactersNextPhysics Settings

Last updated 1 year ago

  • Click on your game object

  • Add Component: "Script Binding"

  • Click "Add Airship Component"

  • Search and select "CharacterConfigSetup"

You now can control many of the core systems. These toggles will fire as soon as your scene is loaded.

If you need to control these options dynamically, they are all accessible via TS

public OnEnable() {
	//Character
	//Set the default prefab to use whenever a character is spawned
	Airship.characters.SetDefaultCharacterPrefab(this.customCharacterPrefab);

	//Local Character Configs
	if (Game.IsClient()) {
		//Movement
		//Control how client inputs are recieved by the movement system
		Airship.characters.localCharacterManager.SetMoveDirWorldSpace(this.movementSpace === Space.World);

		//Camera
		//Toggle the core camera system
		Airship.characterCamera.SetEnabled(this.useAirshipCameraSystem);
		if (this.useAirshipCameraSystem) {
			//Allow clients to toggle their view model
			Airship.characterCamera.canToggleFirstPerson = this.allowFirstPersonToggle;
			if (this.startInFirstPerson) {
				//Change to a new camera mode
				Airship.characterCamera.SetCharacterCameraMode(CharacterCameraMode.Locked);
				//Force first person view model
				Airship.characterCamera.SetFirstPerson(this.startInFirstPerson);
			}
		}

		//UI visual toggles
		Airship.chat.SetUIEnabled(this.showChat);
		Airship.inventory.SetBackpackVisible(this.showInventoryBackpack);
		if (this.showInventoryHotbar || this.showHealthbar) {
			Airship.inventory.SetUIEnabled(true);
			Airship.inventory.SetHealtbarVisible(this.showHealthbar);
			Airship.inventory.SetHotbarVisible(this.showInventoryHotbar);
		} else {
			Airship.inventory.SetUIEnabled(false);
		}
	}

	//Stop any input for some movement options we don't use
	if (!this.enableJumping || !this.enableCrouching || !this.enableSprinting) {
		//Listen to input event
		Airship.characters.localCharacterManager.onBeforeLocalEntityInput.Connect((event) => {
			//Force the event off if we don't want that feature
			if (!this.enableJumping) {
				event.jump = false;
			}
			if (!this.enableCrouching) {
				event.crouchOrSlide = false;
			}
			if (!this.enableSprinting) {
				event.sprinting = false;
			}
		});
	}
}