Skip to content

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

Closed
@Lazy-Rabbit-2001

Description

@Lazy-Rabbit-2001

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions