[Issue/Bug]: Parse error when launching a game with DiscordRPC, even with checks to disable running DiscordRPC in place. #58
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened?
When launching the game on mobile, it crashes while parsing the file where I'm using DiscordRPC, even with checks to avoid running the code on mobile.
Version
1.3.1
Godot Version
4.2.1
Exact steps to reproduce this error
Use DiscordRPC on mobile, but don't run it. You will get this error

GDScript
Godot output
No suitable library found for GDExtension: res://addons/discord-rpc-gd/bin/discord-rpc-gd.gdextension. Possible feature flags for your platform: mobile, android, etc2, astc, arm64, template, debug, template_debug
Additional information
No response
Checks
there is a function to unregister that in GDExtentionManager i think. will send you a solution when I'm at home. on web it doesnt crash never tested it on mobile tbh
Thank you, will be waiting
Sorry for not responding will have time next week
No problem, I'm still developing my game to this day.
Try
before loading any part of the plugin also exclude the plugin in the export settings like the following and tell me if it helped.

I don't have the project anymore where i accomplished this but i remember GDExtensionManager is the way.
Thank you 👍
This did not seem to work for me, and I still get the
Identifier "DiscordRPC" not declared in the current scope
error, despite writing code to avoid running lines with DiscordRPC. I know that it was mentioned in #67 that Discord rich presence is not possible, but I would love to know if there is some sort of workaround to avoid having the game crashing on mobile.Ideally, since try/catch patterns are not a thing in Godot, this plugin should avoid causing crashes on unsupported platforms.
the issue is this is just how godot runs gdextensions i can't change that. Is the autoload maybe still running? you should only add the node conataining a script with discord rpc when the plugin is loaded so you cant do
instead you need to do
then you maybe make a manager with the node saved and run stuff on it when its not null
Okay, thank you for your answer. I ended up making a scene for the Discord rich presence, and put something like this in my main autoload, which seems to do the trick.
I'll add that to the troubleshooting guide if that's okay :)
Sounds good. Feel free to use my bit of code if needed