Buttons work on in-editor runner but not in exported build

Godot Version

v4.6.1

Question

I’m working on a 2D game, and when using the Godot “Run Project” button in the Editor, the window it opens works as intended, I can play my game. But when I compile it to anything, Windows, Linux, Android, doesn’t matter, I can’t click anything on my titlescreen. The hover effects for the buttons work just fine, but nothing happens on click. Running it on Windows with the console executable, I do get the following output:

Godot Engine v4.6.1.stable.official.14d19694e - https://godotengine.orgOpenGL API 3.3.0 - Build 31.0.101.4575 - Compatibility - Using Device: Intel - Intel(R) UHD Graphics 770

ERROR: Attempt to open script ‘res://addons/discord-rpc-gd/nodes/discord_autoload.gd’ resulted in error ‘File not found’.at: (modules/gdscript/gdscript.cpp:1127)ERROR: Failed loading resource: res://addons/discord-rpc-gd/nodes/discord_autoload.gd.at: (core/io/resource_loader.cpp:343)ERROR: Failed to instantiate an autoload, can’t load from path: res://addons/discord-rpc-gd/nodes/discord_autoload.gd.at: (main/main.cpp:4401)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:5)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:7)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:9)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:11)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:13)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:15)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:17)SCRIPT ERROR: Parse Error: Identifier “DiscordRPC” not declared in the current scope.at: GDScript::reload (res://scripts/startScreen.gd:19)ERROR: Failed to load script “res://scripts/startScreen.gd” with error “Parse error”.at: load (modules/gdscript/gdscript.cpp:2907)

I also removed the DiscordRPC code from the titlescreen, and it does let me use the buttons, but then loading the gameplay scene by clicking start gives me this:

Godot Engine v4.6.1.stable.official.14d19694e - https://godotengine.org
OpenGL API 3.3.0 - Build 31.0.101.4575 - Compatibility - Using Device: Intel - Intel(R) UHD Graphics 770

ERROR: Attempt to open script 'res://addons/discord-rpc-gd/nodes/discord_autoload.gd' resulted in error 'File not found'.
   at: (modules/gdscript/gdscript.cpp:1127)
ERROR: Failed loading resource: res://addons/discord-rpc-gd/nodes/discord_autoload.gd.
   at: (core/io/resource_loader.cpp:343)
ERROR: Failed to instantiate an autoload, can't load from path: res://addons/discord-rpc-gd/nodes/discord_autoload.gd.
   at: (main/main.cpp:4401)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:15)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:17)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:19)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:21)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:23)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:25)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:27)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
SCRIPT ERROR: Parse Error: Identifier "DiscordRPC" not declared in the current scope.
          at: GDScript::reload (res://scripts/gameplayController.gd:29)
          GDScript backtrace (most recent call first):
              [0] _on_start_pressed (res://scripts/startScreen.gd:10)
ERROR: Failed to load script "res://scripts/gameplayController.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript.cpp:2907)
   GDScript backtrace (most recent call first):
       [0] _on_start_pressed (res://scripts/startScreen.gd:10)

How do I keep DiscordRPC in the main start screen and still be able to update it in other scenes without it erroring like this?

My guess is that this is an issue with case sensitive paths. Each OS and even the godot editor itself handles case sensitivity differently.
In certain scenarios, the path: path/to/item and Path/To/Item might be “correct” in both cases, but when you export, this falls apart, because those paths are completely different now, since they’re case sensitive on the specific platform you’re trying to run your game on.

I know this might be a huge task, but try to look through your entire project and look at every string where you might be referencing ANY other scene or script, and make sure the case sensitive parts are handled correctly, and are the same everywhere. Or even better, use UIDs instead.

func ready() -> void:
	# Application ID
	DiscordRPC.app_id = 
	# this is boolean if everything worked
	print("Discord working: " + str(DiscordRPC.get_is_discord_working()))
	# Set the first custom text row of the activity here
	DiscordRPC.details = "Alpha 0.0.5"
	# Set the second custom text row of the activity here
	DiscordRPC.state = "Playing against CPU"
	# Image key for large image from "Art Assets" from the Discord Developer website
	DiscordRPC.large_image = "game"
	# Tooltip text for the large image
	DiscordRPC.large_image_text = "my game"
	# "02:41 elapsed" timestamp for the activity
	DiscordRPC.start_timestamp = int(Time.get_unix_time_from_system())
	# Always refresh after changing the values!
	DiscordRPC.refresh()

I’m just using the default Discord RPC configuration with some edits to use my app ID (removed) and my game info, nothing referencing paths to my knowledge. I did remove the entire Discord RPC code from my scripts I used it in, and of course it works.

Godot Engine v4.6.1.stable.official.14d19694e - https://godotengine.org
OpenGL API 3.3.0 - Build 31.0.101.4575 - Compatibility - Using Device: Intel - Intel(R) UHD Graphics 770

ERROR: Attempt to open script 'res://addons/discord-rpc-gd/nodes/discord_autoload.gd' resulted in error 'File not found'.
   at: (modules/gdscript/gdscript.cpp:1127)
ERROR: Failed loading resource: res://addons/discord-rpc-gd/nodes/discord_autoload.gd.
   at: (core/io/resource_loader.cpp:343)
ERROR: Failed to instantiate an autoload, can't load from path: res://addons/discord-rpc-gd/nodes/discord_autoload.gd.
   at: (main/main.cpp:4401)

This is the console output even when all of the Discord RPC code is removed, Discord RPC tries to autoload but fails.

Have you also disabled the addon in your project settings, and removed it’s autoloads?

Disabling the addon of course removes the Discord RPC errors, but I want to be able to have it in there. I have previously gotten Discord RPC added and working as it should, but now it doesn’t. Would it have something to do with the fact I keep the project on a flash drive and work on it from 3 different computers?

I absolutely do not recommend working off of a removable drive. Use Git and something like GitHub or GitLab if you want to work across multiple devices.

I’m attempting to set up GitLab as previously trying to use GitHub it has given me “large file” errors. I’ll report back in like 3-ish hours.

If you have large files, please look into Git LFS
This will not work on GitLab either.