godotengine / godotengine/godot

`_init()` called twice when extending script in inherited scene

Open
#106,933 3 comments 1 reaction 0 assignees View on GitHub
bug confirmed topic:core topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.5 dev4

### System information

W10

### Issue description

When you make inheriting scene and extend the base scene's script, the `_init()` method of the base script is called twice.

### Steps to reproduce

1. Create a scene
2. Add a (non-built-in) script with `_init()` method that prints something
3. Create another scene inheriting that scene
4. Extend the script, can be empty
5. Run the inheriting scene

### Minimal reproduction project (MRP)

[initwice.zip](https://github.com/user-attachments/files/20504752/initwice.zip)
Inheritor.tscn is scene with bug.
NotInheritor is equivalent scene, but without inheritance. No bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.