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

Duplicating Resource scripts breaks the inspector when attaching the duplicate script to a .tres file #86038

Open
jamesridley opened this issue Dec 11, 2023 · 0 comments

Comments

@jamesridley
Copy link

Tested versions

Godot Engine v4.2.stable.official

System information

Godot v4.2.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Ti (NVIDIA; 31.0.15.4601) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)

Issue description

Duplicating a script that inherits from a custom resource, then attaching that script to an "instance" (not sure what to call it) of a resource causes the inspector to stop showing any exported variables from the resource. This only seems to happen when there is a difference in exported variables between the two sibling scripts but I'm not sure. The steps to reproduce should make it a lot clearer.

This happened to me when I was duplicating a script because I knew the next script would have similar code, so I think it's kinda common for this to happen. This was fixed by deleting the script, then making a new one without duplicating anything, and copy pasting manually.

I couldn't find any duplicates (haha) of this issue that specifically come from duplicating scripts, but it's possible that #83343 fixes this. I'm not sure though, since I don't have that version of Godot, nor do I know how to find that version of Godot.

Steps to reproduce

  1. Create a new script test_resource.gd that extends Resource
  2. Paste the following:
class_name TestResource
extends Resource

@export var member_variable: int
  1. Create a new script inherited_resource.gd that extends TestResource
  2. Paste the following
extends TestResource

@export inherited_member_variable: int
  1. Create a new resource new_test_resource.tres. Select TestResource to be the "instancer" (still don't know what to call it)
  2. Right-click then duplicate inherited_resource.gd. Name it inherited_resource2.gd
  3. Replace the script body with the following:
extends TestResource

@export var duplicate_member_variable: int
  1. Double click on new_test_resource.tres
  2. Drag and drop inherited_resource2.gd to the script of new_test_resource in the inspector
  3. Then drag and drop inherited_resource.gd to replace the duplicate
  4. Watch all the variables in the inspector disappear! It should look like this:
    image

Minimal reproduction project (MRP)

resource_duplication_bug.zip

Inspecting the .tres file should show no exported variables after opening the project, since reloading the project did not fix this for me.

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

No branches or pull requests

2 participants