godot icon indicating copy to clipboard operation
godot copied to clipboard

[3.6 Beta] Exported Script CANNOT be given with a default value if assigned without `= null`

Open Lazy-Rabbit-2001 opened this issue 1 year ago • 2 comments

Godot version

3.6 beta1 ~ beta 4

System information

Windows 11, GLES3

Issue description

动画 As the gif displays, when I dragged the script resource to exported variable typed as Script without "= null" assigned, nothing happened on its inspector dock, neither did i pop the menu to add it manually. Also, it showed "null" when running; thus it was actually blocked from setting its value Problematic code:

export var custom_script: Script

Workaround code:

export var custom_script: Script = null

Steps to reproduce

  1. In an existing project, create a node and create a script for it
  2. In that script, set some exported variables and type them as Script or GDScript, without "= null" assigned to that property
  3. Write a new GDScript code, no matter what you want to write
  4. Drag the written one to the inspector dock of that exported property and you will see nothing happened

Minimal reproduction project

Test.zip (Note: Open Goomba.tscn and locate to EnemyKilled)

Lazy-Rabbit-2001 avatar Apr 20 '23 06:04 Lazy-Rabbit-2001

Sometimes it would pop with this image

Lazy-Rabbit-2001 avatar May 26 '23 15:05 Lazy-Rabbit-2001

the bug remains in beta 3

Lazy-Rabbit-2001 avatar Aug 24 '23 04:08 Lazy-Rabbit-2001