VFXMaterial ​
Inherits: RefCounted
A MATERIAL EFFECT on an entity: a material put on the meshes its selection targets (the body, the weapons, a hand, or the hand of the enchanted item) for as long as it lasts — barkskin, ironskin, burning, a glowing blade. It is a layer of MaterialLayers on each mesh (2026-11-14), so it comes off by itself and takes nothing else with it: when its timer ends, when the entity dies, or when the effect that put it on ends (Effect.cleanup_effect_vfx). A layer on an enchanted item's weapon is bound to that weapon's mesh: a weapon swapped in starts clean. It FADES in and out (2026-11-14; the selection's fade_in, fade_out and fade_style): each mesh gets its own copy of the material (MaterialLayers.own_copy) whose layer_fade is set as it fades; a skin is drawn over the body while it comes on and replaces it after, and is drawn over it again while it goes.
Variables ​
Entity # The entity this material effect is applied to | target_entity | |
VFXSelectionMaterial | material_selection | |
Timer | effect_timer | |
Object | item | null |
Array[MeshInstance3D] | layered_meshes | [] |
Array[Material] | layered_copies | [] |
float | fade_amount | 1.0 |
int | fade_style | VFXFade.Style.DISSOLVE |
bool | is_fading_out | false |
bool | is_active | false |
bool | is_finished | false |
VFXSelectionMaterial.MaterialBlendMode | blend_mode | VFXSelectionMaterial.MaterialBlendMode.OVERLAY |
Methods ​
String | layer_key() |
void | apply_to_entity( entity: Entity, selection: VFXSelectionMaterial, timer: Timer = null, for_item: Object = null ) |
void | set_fade( amount: float ) |
void | restore_materials( immediate: bool = false ) |
void | extend_duration( additional_time: float ) |
float | get_remaining_time() |
bool | is_effect_active() |
void | cleanup() |
bool | conflicts_with( other: VFXMaterial ) |
Dictionary | get_debug_info() |
Variable descriptions ​
Entity # The entity this material effect is applied to target_entity ​
========== CORE PROPERTIES ==========
VFXSelectionMaterial material_selection ​
The selection config that created this
Timer effect_timer ​
Timer controlling the effect duration
Object item = null ​
The enchanted item (the owner of the effect) when the target is the item's own hand.
Array[MeshInstance3D] layered_meshes = [] ​
The meshes the layer was put on.
Array[Material] layered_copies = [] ​
The copies of the material on them (one per mesh), how much of it is on, the style of its fade, and the fade running
float fade_amount = 1.0 ​
No description yet.
int fade_style = VFXFade.Style.DISSOLVE ​
No description yet.
bool is_fading_out = false ​
True while it fades out (it is taken off after)
bool is_active = false ​
========== STATE TRACKING ==========
bool is_finished = false ​
True when the material effect is done.
VFXSelectionMaterial.MaterialBlendMode blend_mode = VFXSelectionMaterial.MaterialBlendMode.OVERLAY ​
How the material is combined with the material of the entity.
Method descriptions ​
String layer_key() ​
The key of this effect's layer on the meshes (each material effect its own, so two of the same stack and come off one by one)
void apply_to_entity( entity: Entity, selection: VFXSelectionMaterial, timer: Timer = null, for_item: Object = null ) ​
Apply material effect to an entity (for_item: the enchanted item, for the ITEM target)
void set_fade( amount: float ) ​
How much of the material is on (0 to 1), on every mesh it is on
void restore_materials( immediate: bool = false ) ​
Takes the layer off again (only this effect's layer): it fades out first (the selection's fade_out), unless immediate
void extend_duration( additional_time: float ) ​
Extend the effect duration
float get_remaining_time() ​
Get remaining effect time
bool is_effect_active() ​
Check if effect is still active
void cleanup() ​
Manual cleanup (called when effect should end early)
bool conflicts_with( other: VFXMaterial ) ​
Check if this effect conflicts with another material effect
Dictionary get_debug_info() ​
Get debug info about applied materials