VoxelColorPalette
Limited list of 256 colors in 8-bit format that can be indexed quickly.
Limited list of 256 colors in 8-bit format that can be indexed quickly.
Contains a list of colors that can be accessed quickly by their index. This is useful to store colored voxels with small memory footprint.
It can be used with VoxelMesherCubes.
Note: colors are internally stored with 8-bit components, so floats used by Color will be rounded to the nearest value.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelColorPaletteConstructor
public VoxelColorPalette();Properties2
ColorsProperty
public Color[] Colors { get; set; }Array of all the colors in the palette. It must have 256 elements. You may use this if you want to get or set all colors at once. Otherwise, prefer using VoxelColorPalette.GetColor and VoxelColorPalette.SetColor.
DataProperty
public int[] Data { get; set; }Array used to store colors as 8-bit binary components in the resource file. It must have 256 elements. To access colors with a script, prefer using VoxelColorPalette.GetColor and VoxelColorPalette.SetColor.
Methods8
GetColorColor
public Color GetColor(int index);Gets the color at the given index.
| Name | Type | Default |
|---|---|---|
index | int | — |
ColorGetColorsColor[]
public Color[] GetColors();Color[]GetDataint[]
public int[] GetData();int[]SetColorvoid
public void SetColor(int index, Color color);Sets the color at the given index.
| Name | Type | Default |
|---|---|---|
index | int | — |
color | Color | — |
SetColors2 overloads
public void SetColors(Color[] colors);| Name | Type | Default |
|---|---|---|
colors | Color[] | — |
public void SetColors(ReadOnlySpan<Color> colors);| Name | Type | Default |
|---|---|---|
colors | ReadOnlySpan<Color> | — |
SetData2 overloads
public void SetData(int[] d);| Name | Type | Default |
|---|---|---|
d | int[] | — |
public void SetData(ReadOnlySpan<int> d);| Name | Type | Default |
|---|---|---|
d | ReadOnlySpan<int> | — |
Fields and constants1
MaxColorsField
public const long MaxColors = 256;