How to fix _init() instance being called twice

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


As you can see in the image, my _init() function is called twice. Is it a common error ?
If image doesn’t work:

<Node2D#49543120717> [{ "source": "res://Scripts/Ressource/", "function":  "_init", "line": 42 }, { "source": "res://Scripts/Ressource/", "function": "@implicit_new", "line": 4 }]
<Node2D#49845110622> [{ "source": "res://Scripts/Ressource/", "function": "_init", "line": 42 }]

Note: The script used isn’t attached to any Node, only used in another script like this:

var _player:Entity =

The correct call is the first one.

:bust_in_silhouette: Reply From: Inces

You must have another instance of your Player in project

Weird, I checked all my code, there is no “” Beside the one in my main script. Even in the Scene there is no Node attached with my Player Script.

I’ll keep looking into it, if you have any idea let me know thanks.

Hamzalopode | 2023-05-04 19:52

:bust_in_silhouette: Reply From: Hamzalopode

Error fixed.
For anyone else having this issue:

My scene didn’t display the “logo” script correctly. My script was indeed attached to a Node. To know exactly which one I went to FileSystem → Right Click on your script then click on “view Owners”. After that you know which Node you can detach your script from.

Thanks, gl.