Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save built-in script of a Resource #86696

Closed
potassium-shot opened this issue Jan 1, 2024 · 2 comments · Fixed by #86705
Closed

Can't save built-in script of a Resource #86696

potassium-shot opened this issue Jan 1, 2024 · 2 comments · Fixed by #86705

Comments

@potassium-shot
Copy link

Tested versions

  • Reproducible in: 4.2.1 stable

System information

Godot v4.2.1.stable (b09f793) - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Mon Dec 18 03:57:17 UTC 2023 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU () - Intel(R) Core(TM) i9-10980HK CPU @ 2.40GHz (16 Threads)

Issue description

In a scene you can make a built-in script, as opposed to an external .gd file. This works.

But let's say we have a custom resource with a Script field, and we do the same thing, so click on the field -> New GDScript, then we can't save. Or more precisely, we can save once, but all subsequent saves won't work.

In the editor it looks like it works, but if you launch the game / restart the editor, you can see the script wasn't saved.
You can also check the .tres file in an external text editor, and see that nothing is being saved.

Seems related to #80060

Steps to reproduce

  • Create a godot project
  • Make a custom resource script with a script field:
class_name CustomResourceWithScript extends Resource

@export var some_script: Script
  • Create a resource file of that type
  • Assign the some_script field to a New GDScript
  • Write some code inside after saving at least once
  • Restart the editor, or check the .tres file in an external file
  • The changes should be lost

Minimal reproduction project (MRP)

cant-save-builtin-script-in-resource.zip

@KoBeWi
Copy link
Member

KoBeWi commented Jan 2, 2024

This is because the script has internal path that doesn't belong to a scene. It applies to all resources.
As a workaround, you can save the parent Resource.

@akien-mga akien-mga added this to the 4.3 milestone Jan 2, 2024
@potassium-shot
Copy link
Author

I see, thank you for the advice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants