decal script is self managed, the trick wrote by gertenko
, I see I made mistake in existing script not to put it into ready func.
extends Node3D
static var decals_amount: int = 0
const MAX_DECALS_AMOUNT: int = 10
@onready var decal: Decal = $Decal
func _ready() -> void:
decals_amount += 1
if decals_amount > MAX_DECALS_AMOUNT:
var all_decals := get_tree().get_nodes_in_group("Decals")
all_decals.pop_at(0).queue_free()
print(decal.get_cull_mask())
# cull mask - not 3 "1048571"
# cull mask - all "1048575"
# cull mask - not 3 and 5 "1048555"
func _exit_tree() -> void:
decals_amount -= 1
func _on_timer_timeout() -> void:
queue_free()
decal get removed by timer or count higher than 10.
extends Node3D
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var audio_stream_player_3d: AudioStreamPlayer3D = $AudioStreamPlayer3D
func blast() -> void:
audio_stream_player_3d.play()
animation_player.play("explosion")
animation_player.animation_finished.connect(_on_animation_finished)
func _on_animation_finished(_anim_name: StringName) -> void:
queue_free()
blast get removed by animation finished.