godotengine / godotengine/godot

Export variables don't start filled on Instantiate

Open
#98,403 7 comments 0 reactions 0 assignees View on GitHub
needs testing topic:core
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

## Tested versions
Reproducible in: v4.3.stable.mono.official

### System information

Godot v4.3.stable.mono - Windows 10.0.22631 - GLES3 (Compatibility) - AMD Radeon RX 6600 (Advanced Micro Devices, Inc.; 32.0.12011.1036) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)

### Issue description

![image](https://github.com/user-attachments/assets/a584b519-11e6-41be-b3a2-42c8c663dd7c)
I have this scene with a RigidBody2D. In its script I exported a RigidBody2D and assign the very same RigidBody2D (yeah, the way I have implemented that script need to be done in that way). In **another script** I Instantiate this **IceAndFireFx** via code (C#), but the exported RigidtBody2D variable starts null.

I saw this thread #87837 but it was closed without any solution. Looks like it was closed coz the admin missunderstood the problem. But now I'm facing the same issue.

### Steps to reproduce

- Create a Scene
- Attach a C# script with a Exported variable
- Attatch the script owner to the Exported variable
- Instantiate via code the scene with the Exported variable filled
- Get a null exported variable after instantiate.

### Minimal reproduction project (MRP)

[bugreport.zip](https://github.com/user-attachments/files/17468193/bugreport.zip)

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.