How to merge Rigidbody (When merged it will add 2 instance but i want only 1 instance)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By oONonKunGOo

Now I make a game that ball will merge to another ball.
like Ball_2 collide with Ball_2 will merge to Ball_4.

When the Ball_2 make collide it will call code in Ball_2 to merge and add Ball_4 instance to spawner, But code in Ball_2 call 2 times I want it to call just one time

here the Ball_2 code if you want, Thank you all :smiley:

extends RigidBody2D

var merge = preload("res://Ball_res/Ball_4.res")

func _ready(): # release ball at mouse position
	var mouse_position = get_global_mouse_position()
	if(mouse_position[0] >= -470 and mouse_position[0] <= 470) and (mouse_position[1] >= -300 and mouse_position[1] <= -250) :
		translate(Vector2(mouse_position[0],0))
		pass
	pass

func _on_Ball_2_body_entered(body): # merge ball
	if "Ball_2" in body.name :
		var ball_instance = merge.instance()
		ball_instance.set_name("Ball_4(Clone)")
		Global.merge_position = position
		get_parent().add_child(ball_instance)
		queue_free()
		pass
	pass
:bust_in_silhouette: Reply From: oONonKunGOo

Now I found.
The answer is just made ball send a global variable to Autoload.gd and let Autoload sen variable to the main scene.