Godot Version
4.3
Question
`I’m currently facing an issue when after calling a queue_free function from an RPC, one of the two players in game stops to be syncronized with the other client (position, rotation etc.)
I’ll link both the my main level tree and the script responsible for the player’s shots.
extends Area2D
@export var speed := 100
var direction: Vector2
func _ready() -> void:
_on_ready()
rotation = direction.angle() + PI/2
func _on_ready():
set_multiplayer_authority(get_parent().get_multiplayer_authority())
func _process(delta: float) -> void:
position += direction * speed * delta
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
var shot_owner = get_multiplayer_authority()
if multiplayer.get_unique_id() == shot_owner:
rpc_id(shot_owner,"despawn_shot")
func _on_body_entered(body: Node2D) -> void:
if body is Player and self.get_multiplayer_authority() != body.get_multiplayer_authority():
body.hit()
@rpc("any_peer","call_local")
func despawn_shot():
queue_free()
Both MultiplayerSpawner have the correct authority setted, and the shot instances are being added as direct child of the spawners.