# Changing class defaults (Chaos Vehicles) at runtime

**URL:** <https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992>\
**Category:** International\
**Tags:** vehicle, default-value, unreal-engine, Blueprint, question\
**Created:** [January 15, 2023, 6:50pm UTC](https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992 "2023-01-15T18:50:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevbyMoonlight](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DevbyMoonlight](https://forums.unrealengine.com/u/DevbyMoonlight)\
**Post date:** [January 15, 2023, 6:51pm UTC](https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992/1 "2023-01-15T18:51:00Z")

</div>

It appears that the stats of Chaos Vehicles based vehicles are all in class defaults and private. I can’t be the only one who wants to add a vehicle upgrade system? How are you meant to get around this?

---

<div class="post-metadata">

**Author:** ![EliasWick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eliaswick/32/1175208_2.png) [@EliasWick](https://forums.unrealengine.com/u/EliasWick)\
**Post date:** [January 15, 2023, 8:02pm UTC](https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992/2 "2023-01-15T20:02:28Z")

</div>

I am not super familiar with the Chaos Vehicles, but are you not able to create a Chaos Vehicles-based vehicle class and expose the necessary variables as public? This will allow you to make changes to the vehicle’s stats through blueprint scripting.

Keep in mind that this will likely require a good understanding of the Unreal Engine, C++, and blueprint scripting, and it’s important to properly test the changes you make to ensure the physics simulation remains stable.

---

<div class="post-metadata">

**Author:** ![DevbyMoonlight](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DevbyMoonlight](https://forums.unrealengine.com/u/DevbyMoonlight)\
**Post date:** [January 16, 2023, 10:00am UTC](https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992/3 "2023-01-16T10:00:43Z")

</div>

Cars inherit from WheeledVehiclePawn, which has a ChaosWheeledVehicleMovementComponent with all sorts of stats that are class defaults and setters for a (too) small subset of them. I don’t immediately see a way to expose variables as public via blueprint when they are private in the component you are forced to use. 🤔 Am I missing something?

I was hoping to avoid having to dive into the C++ source files and figure out how to change some class defaults (which I’m assuming are static properties) to instanced variables, but it may be the only option.

Oh well, let’s bite the bullet and learn some C++ then…

---

<div class="post-metadata">

**Author:** ![EliasWick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/eliaswick/32/1175208_2.png) [@EliasWick](https://forums.unrealengine.com/u/EliasWick)\
**Post date:** [January 16, 2023, 10:12am UTC](https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992/4 "2023-01-16T10:12:16Z")

</div>

There are a few ways to expose private variables to Blueprint:

1. You can create a Blueprint-callable function in the component that gets or sets the value of the private variable. This function can then be called from Blueprint.
2. You can use the UPROPERTY(EditAnywhere, BlueprintReadWrite) macro to expose the variable to Blueprint. This macro can be applied to class variables to make them editable in the editor and accessible through Blueprint.
3. You can create a new variable in the parent class (in this case, the WheeledVehiclePawn class) that is exposed to Blueprint and use it to set or get the value of the private variable in the component.
4. You can use a custom EventDispatcher in the component to notify blueprints when the variable changes, and allow them to read the variable value.

I might have gotten something above incorrect, but those are a few of the methods I’d recommend.

---

<div class="post-metadata">

**Author:** ![aln018](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@aln018](https://forums.unrealengine.com/u/aln018)\
**Post date:** [March 14, 2023, 8:48pm UTC](https://forums.unrealengine.com/t/changing-class-defaults-chaos-vehicles-at-runtime/749992/5 "2023-03-14T20:48:53Z")

</div>

Hello friend, I’m Brazilian, I didn’t understand your explanation. Can you explain me better how to do this?
