godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.73k stars 20.12k forks source link

Godot 4.3 Beta 3 - Failed loading resource , wav files and assigning it to export var #94546

Closed EiTaNBaRiBoA closed 5 days ago

EiTaNBaRiBoA commented 1 month ago

Tested versions

System information

Windows 11

Issue description

When importing wav files and assigning them to export var AudioStreamWAV in script that runs in autoload will cause an error when opening the project without .godot image

Steps to reproduce

  1. Create a new godot 4.3 beta 3 project
  2. Create a Play scene (could be a just control node)
  3. Create a folder SoundManager.
  4. Create another scene of type control and add a child of type AutoStreamPlayer
  5. Add a script to the control node and write these lines
    
    extends Node

@export var clockTickingsfx: AudioStreamWAV @export var clockCompleteSfx: AudioStreamWAV @export var sfxAudioStream: AudioStreamPlayer


6. Create a folder inside SoundManager and import a wav file and assign it to both clockCompleteSfx and clockTickingsfx. and assign AutoStreamPlayer to sfxAudioStream
7. Add in Autoload the control scene and you can call it SoundManager
8. Click on play and select the Play Scene as default sene
9. Save, Close godot , delete .godot folder and open it again.
10. Look at the Output and you will see 
![image](https://github.com/user-attachments/assets/e5ddae93-d713-4eb1-a0e1-b8bd715401cf)

### Minimal reproduction project (MRP)

[TestImportCurropted.zip](https://github.com/user-attachments/files/16316703/TestImportCurropted.zip)
Calinou commented 1 month ago

As the error message says:

Make sure resources have been imported by opening the project in the editor at least once.

When the editor imports resources, it writes them to the .godot/ folder. If you remove this folder, you have to open the editor once (or run it with --import from the command line starting with Godot 4.3) to reimport resources. Otherwise, running the project directly won't work.

Hilderin commented 1 month ago

I tested the MRP project and the problem is really just in opening the editor without the .godot folder. The autoloads objects are completely created even if they are not @tool scripts at the editor start and since the imported files are not present in the .godot folder, they fail to load. I fixed this problem in the PR #92667. I tested the MRP with the code of this PR and I have no error message at startup and everything seems fine.

Stacktrace of the error while starting the editor: image