Game.Prefabs.EffectColorSource
Assembly:
Namespace: Game.Prefabs
Type: enum
Base: System.Enum
Summary:
Enum used to select the source of color information for an effect prefab. Determines whether the effect should use a built-in effect color or one of the mesh color channels supplied by the mesh (commonly vertex color channels). Useful when configuring particle/visual effect prefabs so they pick their color from the appropriate source.
Fields
-
Effect
Represents using the effect's own configured color (the color defined directly on the effect). Value = 0. -
MeshChannel0
Use mesh color channel 0 (first vertex color/mesh channel) as the effect color source. Value = 1. -
MeshChannel1
Use mesh color channel 1 (second vertex color/mesh channel) as the effect color source. Value = 2. -
MeshChannel2
Use mesh color channel 2 (third vertex color/mesh channel) as the effect color source. Value = 3.
Properties
- None
This enum does not expose properties.
Constructors
- None
Enums do not define constructors.
Methods
- None
No methods are defined on this enum.
Usage Example
// Select a color source for an effect prefab
Game.Prefabs.EffectColorSource colorSource = Game.Prefabs.EffectColorSource.MeshChannel1;
// Example handling: choose color based on the enum value
Color ResolveEffectColor(GameObject meshObject, Color effectDefaultColor, Game.Prefabs.EffectColorSource source)
{
switch (source)
{
case Game.Prefabs.EffectColorSource.Effect:
return effectDefaultColor;
case Game.Prefabs.EffectColorSource.MeshChannel0:
return GetMeshVertexColor(meshObject, 0) ?? effectDefaultColor;
case Game.Prefabs.EffectColorSource.MeshChannel1:
return GetMeshVertexColor(meshObject, 1) ?? effectDefaultColor;
case Game.Prefabs.EffectColorSource.MeshChannel2:
return GetMeshVertexColor(meshObject, 2) ?? effectDefaultColor;
default:
return effectDefaultColor;
}
}
// Placeholder helper: obtain vertex color from a mesh's channel if available.
// Implement according to the game's mesh data access APIs.
Color? GetMeshVertexColor(GameObject meshObject, int channelIndex)
{
// Implementation depends on the game's mesh/vertex color API.
return null;
}
{{ Notes and tips: - The enum values are simple integer-backed constants; when serialized/stored they are typically represented as ints. - "MeshChannelN" normally refers to vertex color channels supplied with the mesh (check the specific mesh exporter/runtime conventions used by the game's asset pipeline). - When modding, verify how the target effect system expects colors (vertex colors, UV-based channels, or material properties) and map the enum to the appropriate runtime read path. }}