Class VehicleRegistry
Registry utilities for discovering and resolving vehicles without exposing game types.
public static class VehicleRegistry
- Inheritance
-
VehicleRegistry
- Inherited Members
Methods
CreateVehicle(string)
Creates a new vehicle instance using a vehicle code and returns a wrapper. Useful when you need a vehicle that doesn't exist yet.
public static LandVehicle CreateVehicle(string vehicleCode)
Parameters
vehicleCodestringThe vehicle code to spawn (e.g., "Sedan", "SUV", etc.).
Returns
- LandVehicle
A new vehicle wrapper, or null if creation fails.
GetAll()
Returns all currently spawned land vehicles wrapped for modder use.
public static LandVehicle[] GetAll()
Returns
GetByGUID(string)
Finds a vehicle by GUID string. Returns null if not found.
public static LandVehicle GetByGUID(string guid)
Parameters
guidstring
Returns
GetByName(string)
Finds a vehicle by GameObject name. Useful when vehicles aren't spawned yet. Falls back to finding in all vehicles if GameObject.Find fails.
public static LandVehicle GetByName(string gameObjectName)
Parameters
gameObjectNamestringThe name of the GameObject containing the vehicle.
Returns
- LandVehicle
A vehicle wrapper, or null if not found.
RemoveVehicle(string)
Removes a vehicle from the game's lists, for permanently destroying a vehicle. This will be called automatically in OnDestroy, so there's likely no need to call this manually.
public static void RemoveVehicle(string guidString)
Parameters
guidStringstringThe GUID string of the vehicle to remove.