How to check if node is in scene? [C#]

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

I am adding bullets to a scene, but only one at a time.

the way i am doing this right now is like so:

if (Input.IsActionJustPressed("PS_attack")){
        if(GetParent().GetNode<Node2D>("Weapon") == null){

however that it gives a lot of error messages in the terminal saying that the node cant be found (witch is what i want).

is there any way of doing this without error messages?

:bust_in_silhouette: Reply From: Zylann

Use HasNode(path) instead: Node — Godot Engine (stable) documentation in English