Before this, I had a designated boolean value that was set to false and checked every frame to run a function and reset to false if true. This is so much better.

Example:

class_name CollisionMirror  
extends CollisionPolygon2D  

@export var last_known_nodes:PackedVector2Array  
@export var reference: Polygon2D  

@export_tool_button("Update now")  
var ETB_updatenow=self.update_now  

func _process(_delta: float) -> void:  
	if reference:  
		update_now(true)  

func update_now(check:=false):  
	var cur_values:=reference.polygon  
	if check and last_known_nodes==cur_values:  
		return  
	last_known_nodes=cur_values  
	self.polygon=cur_values  

  • Zachariah
    link
    fedilink
    arrow-up
    7
    ·
    22 hours ago
    1. He runs wherever he wants. He’s a cat.
    2. I got all mine from the Cat Distribution System.