-
Notifications
You must be signed in to change notification settings - Fork 6
Grabbers
Grabbers are a special type of component that allow you to use some base game resources (materials, meshes, shaders and sounds) without having to include them with your car.
The available grabbers are:
- Material Grabber
- Material Grabber Renderer
- Mesh Grabber
- Mesh Grabber Filter
- Shader Grabber
- Sound Grabber
- Sound Grabber Source
To use them, just add one of the grabber components to a GameObject.
Tip
Accessing base game resources this way avoids including them in your distributed mod, reducing file size and avoiding asset redistribution.
These grabbers can affect a specific script. After assigning that script to the grabber, it will show which fields of that script are compatible with it.
Here's an example of a Sound Grabber with a Rotary Proxy assigned. Above you can see the fields in the Rotary Proxy, and at the bottom you can see how they are displayed. You can copy these names for convenience.
Add a replacement for each field you want to replace. If that field is an array, select Is Array
and choose the index of the element you want to replace.
When you type into one of these fields, a search is performed and it will display all options that begin with what you have typed.
You can then click the option and it will automatically type the whole thing for you.
Caution
An error will be displayed if the name does not exactly match a value. CCL will not let you export a car if this happens.
Unfortunately, base Unity components work in a different way behind the scenes, and thus cannot be accessed in the same way. To go around it, these components exist. Material Grabber Renderer allows you to assign materials directly to one or more Mesh Renderers at once (for example, multiple LODs of the same model), while Mesh Grabber Filter and Sound Grabber Source allows you to assing a mesh/audio clip directly to a single Mesh Filter/Audio Source.
If the Material Grabbers are not enough for you, the Shader Grabber exists. It allows you to define a material with fake properties matching a base game material, and replace the shader at runtime with the game's implementation.
Caution
Shader Grabbers are much harder to use and require knowledge of base game materials and shaders, so avoid them if you do not need them.