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

Custom features are not working with OS.has_feature or "Override for" #38747

Closed
eastolfi opened this issue May 15, 2020 · 7 comments
Closed

Custom features are not working with OS.has_feature or "Override for" #38747

eastolfi opened this issue May 15, 2020 · 7 comments

Comments

@eastolfi
Copy link

Godot version:
GODOT 3.2.1 - released March 10, 2020

OS/device including version:
Windows 10 Home x64

Issue description:
When trying to export two different build, one for the client and one for the server, the custom features are not working.
If I create a new export template with a custom feature server_build, neither the Override for nor the OS.has_feature seem to be working.

I already saw this issue for the override and this other one for the OS access, but I can't get it working. I just downloaded the latest version of the engine with no success.

Steps to reproduce:

  1. Export the repo with the default features
    • Should show a main screen with a label "Client Build" and printing in the console "The client build"
  2. Export the repo with a custom feature server_build
    • EXPECTED Should show a main screen with a label "Server Build" and printing in the console "The server build"
    • RESULT The same main screen and console output are shown, as if the build was made without the custom feature

Minimal reproduction project:
custom_feature_bug.zip

@Luzkan
Copy link

Luzkan commented May 25, 2020

Okay, that was a bug that I've been facing since the beginning of my project around 2 months ago. I couldn't think of any workarounds or fixes up until now.

Hopefully it gets properly fixed soon - commeting the if/else to get server/client version of my project for n'th time was driving me insane and today I figured out this temp solution.

Instead of using custom feature to differentiate between server and client - do it through executable name:

func check_if_server() -> bool: return OS.get_executable_path().ends_with("Server.exe")

Hope it serves you well for the time being. Cheers!

@eastolfi
Copy link
Author

Thanks @Luzkan I'll give it a try!

@systemsoverload
Copy link

Any word on a fix? This is a bad blocker for me as Im trying to create a client and server in one project. Can't build either without modifying code between exports

@Calinou
Copy link
Member

Calinou commented Jun 11, 2020

@systemsoverload I don't think anyone is working on a fix right now, but as a workaround, you could:

@mrimvo
Copy link

mrimvo commented Jun 11, 2020

Another idea: let your build script change constant variables in your .gd file between Exports. Maybe you got a auto-loaded Constants.is_server=true, you can automatically change to false before exporting a client.

I'm using a python script to build, deploy and publish my game, and I do this kind of thing to set a version number that both server and client can read and check for. As far as I know, such a game version attribute is badly missing in godot too. You can set version attributes for some exports (not all of them) but you can't read them from code.

@Calinou
Copy link
Member

Calinou commented Jun 11, 2020

@mrimvo There's a pull request that implements a version project setting: #35555

@KoBeWi
Copy link
Member

KoBeWi commented Oct 21, 2020

This is another bug actually, see #42978
Everything will work when you move the executable outside your project directory.

@KoBeWi KoBeWi closed this as completed Oct 21, 2020
@KoBeWi KoBeWi removed this from the 4.0 milestone Oct 21, 2020
@akien-mga akien-mga added this to the 4.0 milestone Oct 22, 2020
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