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

Changes made to Scripts not visible until project is reloaded #90309

Closed
aniezurawski opened this issue Apr 6, 2024 · 11 comments
Closed

Changes made to Scripts not visible until project is reloaded #90309

aniezurawski opened this issue Apr 6, 2024 · 11 comments

Comments

@aniezurawski
Copy link

Tested versions

Reproducible in: v4.2.1.stable.official

According to this thread on reddit there was no issue in 4.1: https://www.reddit.com/r/godot/comments/18euilr/have_to_reload_whole_project_to_load_changes_in/

System information

Godot v4.2.1.stable - Ubuntu 22.04.4 LTS 22.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 () - AMD Ryzen 7 7800X3D 8-Core Processor (16 Threads)

Issue description

Saved changes (made via Godot editor, not anything external) in some Script files are not reflected in hints/interpreter until whole project is reloaded causing some false-positive errors to be displayed in editor.
Notice, it does not affect executing (Run) Project or Scene. They run successfully. Only Editor is affected.
It does not affect all scripts. Only script extending other custom scripts with circular dependencies seem to be affected.
If circular dependency is an issue there should be some warning at least instead of silently breaking things. But since execution works correctly then editor probably should as well. Also all methods are visible again after project is reloaded.

Steps to reproduce

  1. Create new project.
  2. Create new Script A.gd:
class_name A extends RefCounted

static func foo():
	B.bar()
  1. Create new Script B.gd. You can see a hint for A.foo() when typing.
class_name B extends RefCounted

static func bar():
	A.foo()
  1. Add new method to A.gd:
static func test():
	B.bar()
  1. Hints for A.test() still work correctly in file B.
  2. Change B.gd to extend A:
class_name B extends A

static func bar():
	A.foo()
  1. Add yet another method to A.gd:
static func not_working():
	B.bar()
  1. Any changes made to A are not visible when editing B anymore.

Minimal reproduction project (MRP)

example.zip

@AThousandShips
Copy link
Member

Can you try this in 4.2.2.rc2? Or 4.3.dev5?

@aniezurawski
Copy link
Author

aniezurawski commented Apr 6, 2024

Can you try this in 4.2.2.rc2? Or 4.3.dev5?

@AThousandShips issue still exists on both these versions.

Same behaviour. Works only if B does not extend A.

@NickMakesGames
Copy link

I find that this issue also happens when adding or removing consts from a file. If I have

extends Node
class_name CONSTS

const CONST_A= "CONST_A"

and some other script

extends Node

func _init();
  print(CONSTS.CONST_A)

everything works fine. But if I then add CONST_B = "CONST_B" to my consts file and try to print that instead, the editor will show an error that CONST_B does not exist. Not sure if this is the same root cause as the OP, but it seems like very similar behavior

@KoBeWi
Copy link
Member

KoBeWi commented Apr 6, 2024

Duplicate of #76383
Thanks for the extra information.

@KoBeWi KoBeWi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
@KoBeWi KoBeWi added the archived label Apr 6, 2024
@mihe
Copy link
Contributor

mihe commented May 2, 2024

@KoBeWi I don't believe this was a duplicate of #76383 after all. As far as I can tell this issue has been resolved as of #90601, so was presumably more related to #81292 (if not an outright duplicate).

@aniezurawski The fix for this should be in 4.3-dev6, if you're able to confirm this as well.

#76383 remains unresolved though.

CC @rune-scape.

@rune-scape
Copy link
Contributor

oops, i did notice this wasnt completely fixed ,, its because in #90601 only scripts that are directly dependant on the invalidated parser will reparse that script,, im working on a follow up that invalidates all dependants but it also requires fixing a bug in the analyzer ..

@aniezurawski
Copy link
Author

@aniezurawski The fix for this should be in 4.3-dev6, if you're able to confirm this as well.

@mihe I can confirm it now works correctly for my minimal reproduction project but I still have issues in my bigger project. I'll try to prepare new example later.

@Maumoleseullevrai
Copy link

Hello there, I had the same issue (updates to variables or functions, or new class names in my resources scripts wouldn't be updated in other scripts that used those resources, and copy pasting the formulas would result in false errors). I was using 4.2 stable.

I've moved to 4.3-dev6 and the issue is now fixed, the new formulas and variables show in the editor and I don't have any false error anymore

@touhidurrr
Copy link

@aniezurawski The fix for this should be in 4.3-dev6, if you're able to confirm this as well.

When I save my GDScript code in editor in 4.3 stable release, the changes are not reflected in the opened game. Sometimes the game crashes. In short only restarting works.

Can anyone try to reproduce this issue again?

@mihe
Copy link
Contributor

mihe commented Aug 16, 2024

When I save my GDScript code in editor in 4.3 stable release, the changes are not reflected in the opened game.

@touhidurrr I believe you're seeing a different issue than what's reported here. This is about the script editor "desynchronizing" with the actual state of the script files in the project. What you're describing sounds more like issues with hot-reloading. I would recommend that you create a new issue for it.

@aniezurawski
Copy link
Author

I got back to my project after few months and looks like it works now. Thanks!

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

8 participants