On this page
Reference

Scripting API

CCDS is a static class in BoneCrackerGames.CCDS (Assets/CCDS/Scripts/Base/CCDS.cs). It is the supported entry point for money, ownership, game state, settings, missions and layers.

Prefer it over reaching into managers directly. It handles save initialisation, persistence and event raising, which hand-written manager access does not.

C#
using BoneCrackerGames.CCDS;

Player data

Method Returns Notes
GetMoney() int Current balance
ChangeMoney(int amount) void Adds amount. Pass a negative value to charge. Saves and raises OnMoneyChanged.
GetPlayerName() string
SetPlayerName(string name) void Minimum 3 characters. Shorter input logs a warning and does nothing. Also updates the Photon nickname, CCDS_NetworkManager.playerName and the spawned player.

ChangeMoney does not clamp. Nothing prevents a negative balance — check GetMoney() before charging.

Vehicle ownership

Method Returns Notes
GetVehicle() int Selected vehicle index
SetVehicle(int index) void Select a vehicle
IsOwnedVehicle(int index) bool
UnlockVehicle(int index) void
LockVehicle(int index) void
UnlockAllVehicles() void Useful while testing
LockAllVehicles() void

The index is the position in CCDS_PlayerVehicles.playerVehicles, and it is persisted. Reordering that array reassigns vehicles for existing players.

Purchases

Method Returns Notes
IsItemPurchased(string saveKey) bool
PurchaseItem(string saveKey) void Marks owned and saves
IsUpgradePurchased(string saveKey) bool
PurchaseUpgrade(string saveKey) void Marks purchased and saves

Neither purchase method charges the player. Deduct with ChangeMoney yourself.

C#
if (!CCDS.IsItemPurchased("paint_red") && CCDS.GetMoney() >= 500) {
    CCDS.ChangeMoney(-500);
    CCDS.PurchaseItem("paint_red");
}

Game state

Method Returns Notes
IsMultiplayer() bool Use this rather than raw Photon checks
PauseGame() void Raises OnPaused
ResumeGame() void Raises OnResumed
RestartGame() void
MainMenu() void Returns to the main menu, raises OnMainMenu
SetScene(int index) void Selects the gameplay scene
GetScene() int
StartGameplayScene() void Loads it; uses PhotonNetwork.LoadLevel when connected and in a room
IsFirstGameplay() bool
SetFirstGameplay() void
ResetGame() void Deletes the save data and reloads. No confirmation.

Settings

Every setter persists and raises the matching event. These are the runtime, player-facing counterparts to the default* fields in CCDS_Settings.

Getter Setter Type Range
GetShadows() SetShadows(bool) bool —
GetSoftShadows() SetSoftShadows(bool) bool —
GetShadowResolution() SetShadowResolution(int) int 0–3
GetImageEffects() SetImageEffects(bool) bool —
GetDrawDistance() SetDrawDistance(float) float 500–5000
GetMaxRealtimeLights() SetMaxRealtimeLights(int) int 0–16
GetAntialiasingMode() SetAntialiasingMode(int) int 0 None, 1 FXAA, 2 SMAA
GetAudioVolume() SetAudioVolume(float) float 0–1
GetMusicVolume() SetMusicVolume(float) float 0–1
GetAutoHandbrake() SetAutoHandbrake(bool) bool —
GetTrafficDensity() SetTrafficDensity(float) float 0–2
GetPreferMultiplayer() SetPreferMultiplayer(bool) bool —

Traffic

Method Notes
DisableTrafficForAWhile() Temporary suppression, e.g. during a race
ToggleTrafficPermanently(bool state) Until changed back

Both route through RTC_SceneManager.

Vehicle checks

Each has an ACCDS_Vehicle / RCCP_CarController overload and a GameObject overload.

Method Returns
IsLocalPlayerVehicle(...) bool
IsCopCar(...) bool
IsClientCar(...) bool
IsAICar(...) bool
RepairVehicle(CCDS_Player player) void
C#
void OnCollisionEnter(Collision col) {
    if (CCDS.IsCopCar(col.gameObject))
        CCDS.DebugLog("Hit a police car");
}

Creation helpers

Method Returns Requires
CreateMission(string name, MissionType type) GameObject CCDS_MissionObjectiveManager in the scene
CreateCop(GameObject prefab, Vector3 pos, Quaternion rot) GameObject Prefab with CCDS_AI_Cop
CreateCop(Vector3 pos) GameObject CCDS_Settings.copVehicle
CreateMissionPosition(string name = null) CCDS_MissionObjectivePosition CCDS_MissionObjectivePositionsManager
CreateMissionPosition(Vector3 pos, Quaternion rot, string name = null) CCDS_MissionObjectivePosition Same

All return null and log an error when the required manager is absent.

C#
GameObject mission = CCDS.CreateMission("Harbour Run", CCDS.MissionType.Checkpoint);
if (mission == null) return;   // manager missing

CCDS.CreateMissionPosition(new Vector3(10f, 0f, 0f), Quaternion.identity, "CP_01");

Chat

Method Notes
ShowChat()
HideChat()
ToggleChatVisibility()
SetChatVisibilityMode(ChatVisibilityMode mode) AlwaysVisible, ShowOnNewMessages, Hidden

Layers

Method Returns Notes
GetLayerIndex(string name) int
LayerExists(string name) bool
GetLayerMask(string name) LayerMask
IsOnLayer(GameObject obj, string name) bool
SetLayerRecursively(GameObject obj, string name, bool recursive = true) void
EnsureLayer(GameObject obj, string name, bool recursive = true) bool Respects CCDS_Settings.enableAutoLayerManagement

Persistence

Method Notes
Save() Write save data
Load() Read it back

ChangeMoney, SetPlayerName, PurchaseItem, PurchaseUpgrade and the settings setters already save. Call Save() only after writing saveData fields directly.

Logging

Method Emits when
DebugLog(string message) CCDS_Settings.enableDebugMessages is true
DebugLogWarning(string message) Always
DebugLogWarning(string message, Object context) Always
DebugLogError(string message) Always
DebugLogError(string message, Object context) Always

Use these instead of Debug.* in CCDS code. All routes also raise CCDS_Events.OnDebugLog, which is how the in-game debug console receives them.

Enums

C#
CCDS.MissionType        // Checkpoint, Pursuit, Race, Trailblazer
ChatVisibilityMode      // AlwaysVisible, ShowOnNewMessages, Hidden
CCDS_GameStates.GameState   // Stopped, Countdown, Paused, Started
CCDS_GameModes.Mode         // Race, Trailblazer, Pursuit, Checkpoint

Save data access

Reading saveData directly is supported, but initialise first:

C#
CCDS_SaveGameManager.EnsureInitialized();
float distance = CCDS_SaveGameManager.saveData.totalDistanceDriven;
CCDS_SaveGameManager.saveData.totalDistanceDriven += delta;
CCDS.Save();

Skipping EnsureInitialized() risks reading a null or stale object. CCDS.cs calls it in over twenty places for this reason.

Culture

CCDS_FixCultureEditor and FixCultureRuntime pin Thread.CurrentCulture to InvariantCulture in both the editor and play mode.

Do not write code that depends on locale-aware parsing or formatting — it will behave differently from the rest of the project. Numbers parse and format invariantly everywhere in CCDS.

Next

(c) 2014 - 2026 BoneCracker Games - City Car Driving Simulator 1.6Back to top ↑
Document details

Generated from: 04_Reference/01_Scripting_API.md
Date: 2026-09-15 07:52
(c) 2014 - 2026 BoneCracker Games - City Car Driving Simulator 1.6