Recoloring in the Moonpool - NeisesMike/VehicleFramework GitHub Wiki

We like to customize the color of our vehicles.

Certain VF vehicles can fit into the Moonpool.

VF vehicles docked in the moonpool can use the Vehicle Upgrade Console to change the color of the vehicle.

Overview

ModVehicle has the virtual methods:

public virtual void SetBaseColor(Vector3 hsb, Color color)
{
}
public virtual void SetInteriorColor(Vector3 hsb, Color color)
{
}
public virtual void SetStripeColor(Vector3 hsb, Color color)
{
}

These methods pass the inputs from the Moonpool's color picker to your ModVehicle.

For example, see how the Blossom overrides those methods:

public override void SetBaseColor(Vector3 hsb, Color color)
{
    transform.Find("ExteriorMain").GetComponent<Renderer>().material.color = color;
    foreach (Transform wing in transform.Find("Wings"))
    {
        wing.GetComponent<Renderer>().material.color = color;
    }
}
public override void SetInteriorColor(Vector3 hsb, Color color)
{
    transform.Find("InteriorMain").GetComponent<Renderer>().material.color = color;
}
public override void SetStripeColor(Vector3 hsb, Color color)
{
}

Notice that the Blossom does nothing with SetStripeColor. That's okay.

These method names are not important except in that they reflect the named tabs on the color picker screen.

But you have no obligation to make the "SetInteriorColor" method do anything with the interior of your vehicle. In other words, you could use that method to change something on the outside of your vehicle. The color picker names won't change for the Player, but you can make these methods do whatever you want in response to a color being picked.

The Blossom was designed in such a way that it was easy to access the material.color to make a big change, and this is by far the easiest and most performant way to do this.

Good luck!

⚠️ **GitHub.com Fallback** ⚠️