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

Scripts not added retroactively to instanced inherited scenes open in editor #10156

Open
Tracked by #4778
Edmanbosch opened this issue Aug 7, 2017 · 13 comments
Open
Tracked by #4778

Comments

@Edmanbosch
Copy link

Edmanbosch commented Aug 7, 2017

bugsquad edit: reproduction steps which were used to confirm the issue are here: #10156 (comment)


Operating system or device - Godot version:
OS: Windows
Godot Version: 3.0 Alpha Build 1

Issue description:
I have found a problem where when I add a script to a scene, all nodes that instance that scene don't get the script.

Steps to reproduce:

  1. Make a scene that you will instance.
  2. Instance that scene into the scene your game will run.
  3. Add a script to the original scene.
@kubecz3k
Copy link
Contributor

kubecz3k commented Aug 8, 2017

edit: this comment is totally useless
I believe the way how it's working currently is a design decision. Usually you should create companion script at the time of creating new scene, so when it will be added to the scene, the information about this script and related node will be saved inside scene file (the one which is parent of instanced scene).
The problem is, it would be hard to behave properly in each scenario if we would just assume that all instanced scenes should have the same script which is defined in the source file. We wanted to have ability to change scripts locally for instanced scenes, or remove scripts entirely if developer decides it's what he need.

@akien-mga akien-mga changed the title Godot 3.0: Scripts Not Added to Instanced Scenes Scripts Not Added to Instanced Scenes Aug 8, 2017
@kubecz3k
Copy link
Contributor

kubecz3k commented Aug 8, 2017

Ok I was wrong, @akien-mga help me realize it's a real bug which was not present in 2.x. Sorry for being smart-ass!

@kubecz3k
Copy link
Contributor

kubecz3k commented Aug 8, 2017

I was trying to reproduce, but I was unable to do this with provided reproduction steps.

But after adding inheritance to the mix, the issue is reproducible for me:

  1. Create World scene, save it.
  2. Create Base scene, save it.
  3. Create Child scene which is extending Base, save it.
  4. Add Childto the World, save
  5. Add script to the root node of Base scene, save it.
  6. Check Child scene and observe that script is present.
  7. Check World scene and observe that script is not attached to instanced Child node.

I used db7f491 build

@akien-mga akien-mga changed the title Scripts Not Added to Instanced Scenes Scripts not added retroactively to instanced inherited scenes Jan 9, 2018
@akien-mga
Copy link
Member

akien-mga commented Jan 9, 2018

I can still reproduce this in the current master branch (52165fa). There's a workaround though, as when following the above steps to reproduce, the Child node in the World scene will indeed lack the new script, but its script property will be shown as modified with a button to revert to the base value.

As such, it's not necessarily critical to fix for 3.0, so moving to 3.1 milestone.

@akien-mga akien-mga modified the milestones: 3.0, 3.1 Jan 9, 2018
@reduz reduz self-assigned this Sep 5, 2018
@Piet-G
Copy link
Contributor

Piet-G commented Oct 15, 2018

Could not reproduce this on master 451e5fd.

@akien-mga
Copy link
Member

I could still reproduce on master using the exact steps outlined in #10156 (comment).

Reopening the World scene fixes it though, it's only a temporary issue.

@akien-mga akien-mga changed the title Scripts not added retroactively to instanced inherited scenes Scripts not added retroactively to instanced inherited scenes open in editor Oct 16, 2018
@akien-mga akien-mga removed this from the 3.1 milestone Oct 16, 2018
@akien-mga
Copy link
Member

It's only a cosmetic issue as things do work once you reload the scene/run the game, so not blocking for the 3.1 milestone.

@Piet-G
Copy link
Contributor

Piet-G commented Oct 16, 2018

Oh yeah I reloaded the scene, that makes sense.

@KoBeWi
Copy link
Member

KoBeWi commented May 24, 2019

I can't seem to reproduce it in 3.1.1

@akien-mga
Copy link
Member

Still reproducible for me in master (a46b8e1), again following the precise steps outlined in #10156 (comment)

If you close World and reopen it after having changed the Base scene, the bug doesn't appear. It's strictly a bug with reloading the instanced inherited scene to take changes of its base scene into account.

@KoBeWi
Copy link
Member

KoBeWi commented May 24, 2019

Ah, I was adding the script to Child scene. Nevermind then.

@Anutrix
Copy link
Contributor

Anutrix commented Jul 13, 2019

As far as I can understand, refresh/fix should happen somewhere in

void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node *parent, int p_pos) {

Am I wrong?

@KoBeWi
Copy link
Member

KoBeWi commented Aug 22, 2020

Sooo I tried to reproduce it in 3.2.3 rc4 and reloading the scene no longer helps. Here's what I get in the tscn file:

[node name="Child" parent="." instance=ExtResource( 1 )]
script = null

So it got worse.

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

7 participants