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

[4.4.dev7] The Default Environment setting is reset after the "cold" project loading (res:// | uid:// issue) #100915

Open
MikkBenelis opened this issue Dec 29, 2024 · 3 comments

Comments

@MikkBenelis
Copy link

Tested versions

  • reproducible in 4.4.dev7 (maybe 4.4.x)
  • not reproducible: 4.3.stable

System information

Godot v4.4.dev7 - Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 32.0.15.6636) - 12th Gen Intel(R) Core(TM) i5-12400 (12 threads)

Issue description

The default environment setting (rendering/environment/defaults/default_environment) is reset after the "cold" project loading (deleting the .godot folder and loading project for the first time). However, it stays on place if it was saved as res://... path, not as uid://... value. Seems like uid related bug.

Steps to reproduce

Steps for 4.4.dev7:

  • create new project;
  • create an Environment asset;
  • set it as default in Project Settings;
  • close the project;
  • delete the .godot folder;
  • open the project.

Not reproduced with 4.3 -> 4.4 migration because its value will still be saved as res://, not uid://.

Minimal reproduction project (MRP)

test.zip

@MikkBenelis MikkBenelis changed the title [4.4.dev7] The Default Environment setting is reset after the "cold" project loading (res:// | uid:// issue) [4.4.dev7] The Default Environment setting is reset after the **"cold"** project loading (res:// | uid:// issue) Dec 29, 2024
@MikkBenelis MikkBenelis changed the title [4.4.dev7] The Default Environment setting is reset after the **"cold"** project loading (res:// | uid:// issue) [4.4.dev7] The Default Environment setting is reset after the "cold" project loading (res:// | uid:// issue) Dec 29, 2024
@MikkBenelis
Copy link
Author

MikkBenelis commented Dec 29, 2024

Seems like the Main Scene (run/main_scene) setting has a similar issue: Godot will not open the Main Scene after the "cold" loading if it is saved as uid:// value, but open perfectly fine if it is saved as res://. Shoud I create a separate issue for that? Pretty sure it is the same, but in theory can require a fix in several places.
P.S.: The Main Scene setting is automatically replaced with uid after manually changing it to res.

@Summersay415
Copy link
Contributor

This maybe due to running scan of filesystem after loading environment and main scene, or something like what. Needs investigating

@KoBeWi
Copy link
Member

KoBeWi commented Jan 17, 2025

The environment is loaded in SceneTree constructor, which happens before any filesystem scan that could load the UID. And interestingly, the code deletes the settting if file can't be found.

String env_path = GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/environment/defaults/default_environment", PROPERTY_HINT_FILE, ext_hint), "");
// Setup property.
env_path = env_path.strip_edges();
if (!env_path.is_empty()) {
Ref<Environment> env = ResourceLoader::load(env_path);
if (env.is_valid()) {
root->get_world_3d()->set_fallback_environment(env);
} else {
if (Engine::get_singleton()->is_editor_hint()) {
// File was erased, clear the field.
ProjectSettings::get_singleton()->set("rendering/environment/defaults/default_environment", "");
} else {
// File was erased, notify user.
ERR_PRINT("Default Environment as specified in the project setting \"rendering/environment/defaults/default_environment\" could not be loaded.");
}

@KoBeWi KoBeWi moved this from Unassessed to Bad in 4.x Release Blockers Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Development

No branches or pull requests

4 participants