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:
Minimal reproduction project:
custom_feature_bug.zip
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!
Thanks @Luzkan I'll give it a try!
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
@systemsoverload I don't think anyone is working on a fix right now, but as a workaround, you could:
OS.get_environment().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.
@mrimvo There's a pull request that implements a version project setting: #35555
This is another bug actually, see #42978
Everything will work when you move the executable outside your project directory.
Most helpful comment
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!