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

.godot folder corrupted after being recreated when several PCK files are included into Main-PCK at build in DotNet C# #86163

Open
aignermax opened this issue Dec 14, 2023 · 10 comments

Comments

@aignermax
Copy link

Tested versions

reproduceable with all Godot 4.x versions - I used 4.1.3 and 4.2.1

System information

Windows 11 - Godot 4.2.1 and Godot 4.1.3 stable C# DotNet

Issue description

when I add .godot to gitignore, I can build, but the exe file shows error messages when I try to include the PCKGreeting.pck file that lives within the executable's .pck file.

I need to have several pck files inside of my project (and thus also inside of the exported main.pck file) as I will have some "standard components" and others that a modder could add to the project from the harddrive.

I also have some github actions that will build the whole project manually and I have provided a buildManually.ps1 file that simulates that, so we can see the issue.

image

Steps to reproduce

Steps Using the repo

  • clone this git repo
  • rename the .godot folder
  • run the "buildManually.ps1" (right click -> run or use powershell)
  • open the folder "Release"
  • run the exe and see the error (on other projects you see different behaviours - usually no error, but the software fails to load most scripts)
    image

how it should be

*then again when you use the original .godot folder

  • (delete the newly created one and
  • rename the original one back), it can build properly (still showing some error messages)
  • start the exe in the Release folder and it works just fine showing "PCK successfully loaded"
    image

Manual Steps

  • ok so first you have to export some project as an PCK file using the exporter and "export as PCK"
  • enter a name withe the .PCK extension
  • save it into you project folder
  • export your whole project for Windows once
  • open the export_presets.cfg file and override the line include_filter like so:
    • include_filter="*.pck"
  • build the project again
  • then rename the .godot folder and build again and start the built exe to see the error.

Minimal reproduction project (MRP)

it is funny btw. that the description here even asks me to not provide the .godot folder, but without it you cannot test this, so I will provide the .godot as well, please don't do any harm.
image

Godot PCK Demo Project

@AThousandShips
Copy link
Member

You probably need to run the editor to generate the data first once, see here, this is how it's done for testing in godot-cpp

@fire fire changed the title GODOT headless build misses PCK files when .godot gets deleted (gitignored) DotNet C# Headless build cannot add PCK files when .godot gets deleted (gitignored) in DotNet C# Dec 14, 2023
@aignermax
Copy link
Author

You probably need to run the editor to generate the data first once, see here, this is how it's done for testing in godot-cpp

Thank you for the suggestion, @AThousandShips but the problem is not, that the .godot folder does not get created - it gets created successfully in godot 4.2.1 - the problem is moreover linked to the .godot folder being corrupted as soon as you have .PCK files included in your project.
the only valid .godot folder seems to be the one that existed at the time when the .pck file got imported into the project as far as I understand..

I have added your step of opening the editor into my .ps1 script in the example repo above so one can see that this is not enough.

Just run the script "buildManually.ps1" in your windows machine locally

@aignermax aignermax changed the title Headless build cannot add PCK files when .godot gets deleted (gitignored) in DotNet C# .godot folder corrupted after being recreated when several PCK files are included into Main-PCK file at build in DotNet C# Dec 15, 2023
@aignermax aignermax changed the title .godot folder corrupted after being recreated when several PCK files are included into Main-PCK file at build in DotNet C# .godot folder corrupted after being recreated when several PCK files are included into Main-PCK at build in DotNet C# Dec 15, 2023
@AThousandShips
Copy link
Member

For support questions and help please first turn to the other community channels, this is for bug reporting, not a help desk. Please use other channels first to see if this is a bug or user error.

@aignermax
Copy link
Author

aignermax commented Dec 15, 2023

For support questions and help please first turn to the other community channels, this is for bug reporting, not a help desk. Please use other channels first to see if this is a bug or user error.

What makes you feel that it is not a bug? You could simply start up the Godot Project and try to build the project using the Godot Editor and you would see that it fails (?)

Just delete the .godot folder in the provided repository, open the project and try to build it (and to run the release of course).

@AThousandShips
Copy link
Member

AThousandShips commented Dec 15, 2023

I didn't say it wasn't a bug 🙃, I said to go there and discuss it and see if you are doing something wrong, I also do not use dotnet so I can't test this

It's a much better use of everyone's time to ask for support elsewhere, before reporting it here 🙂

@aignermax
Copy link
Author

I didn't say it wasn't a bug 🙃, I said to go there and discuss it and see if you are doing something wrong, I also do not use dotnet so I can't test this

It's a much better use of everyone's time to ask for support elsewhere, before reporting it here 🙂

ok in this case thank you for the link, actually I really did not know that there was a new forum - last time I looked I had the impression that I could not register due to some maintainance that went on for a while, so I will definitely also have a look there, too :)
still I really worked on that problem for almost a week now, but of course I could be wrong, I still just hope and believe that the report of my issue is of some use and it is not just some other unrelated error.

@AThousandShips
Copy link
Member

I understand, and someone might come around and help you here too, but chances are that you are more likely to find help there if it doesn't end up being a bug but a configuration error

Also do consider other community channels than just the forums for support, it's far from the only one 🙂

@aignermax
Copy link
Author

so I did some more tests now and it seems that the only way to get the project to work is to open the editor and press F5 - which I cannot do within github actions, can I?
I have tried to simply compile and/or start the whole project before exporting it, but nothing works no "--path ." or "--quit-after 100" or "--headless" or "--editor"
is there a way to do whatever happens when I press "F5" via the command line?

@aignermax
Copy link
Author

aignermax commented Jan 8, 2024

ok so I have found the solution now:
it turned out, that when you pre-run the godot editor you have to add the parameter --build-solutions
then when you run the godot --headless again, it loads all scripts successfully.

So the code or github workflow should have both those two lines:

godot --headless --build-solutions --quit || exit 0
godot --headless --export-release "Windows Desktop"

The weird thing here is, that it will successfully build even if you leave out the --build-solutions but when you start your game, some scripts won't work.

I think it should at least give you an error message instead of silently accepting the corruptness of the setup?

Took me a couple days to get that to work🙈
What do you guys think?

@Tichau
Copy link

Tichau commented Apr 11, 2024

Hello, I encountered a similar issue (I'm searching for a working build script for 2 days now ^^).
You solution did works better that the previous I had but I still have an issue. When I build from command line the Shader parameters of my custom shaders set from ShaderMaterial resources (not by code) are not taken in account.

The only way to make a proper build is to delete .godot folder restart the engine by hand, then doing an export by hand.

There is still a possibility that this is a export issue that is not 100% reproducible but for now I've never succeeded to make a proper build using command line.

Edit: I found a workaround for my other issue here: #66842 and the fix is coming in 4.3 -> #87392

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

3 participants