Plugin not working on macOS #52

Closed
opened 2024-01-29 14:43:53 +00:00 by shps18ppt · 6 comments
shps18ppt commented 2024-01-29 14:43:53 +00:00 (Migrated from github.com)

What happened?

When I tried enabling the plugin, an error occurs. Here's the error message for your reference: Unable to load addon script from path: 'res://addons/discord-sdk-gd/plugin.gd'. This might be due to a code error in that script.
Disabling the addon at 'res://addons/discord-sdk-gd/plugin.cfg' to prevent further errors.

Version

1.1.0

Godot Version

4.2.1

Exact steps to reproduce this error

I downloaded it from https://godotengine.org/asset-library/asset/1855 and copied it manually. I also tried doing it automatically by using Godot's built it asset button.

GDScript

@tool
extends EditorPlugin

const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/Debug.svg")
var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate()
var plugin_cfg: ConfigFile = ConfigFile.new()
const plugin_data_filename = "/plugin_data.cfg"

func _enter_tree() -> void:
	add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
	EditorInterface.get_editor_settings().settings_changed.connect(_on_editor_settings_changed)

func _ready() -> void:
	await get_tree().create_timer(0.5).timeout
	plugin_cfg.load(EditorInterface.get_editor_paths().get_data_dir() + plugin_data_filename)
	if !EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
		EditorInterface.get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",plugin_cfg.get_value("Discord","editor_presence",false))

func _exit_tree():
	if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
		EditorInterface.get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")

func _enable_plugin() -> void:
	if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"):
		DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore")
	add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd")
	restart_window.connect("confirmed", save_no_restart)
	restart_window.connect("canceled", save_and_restart)
	EditorInterface.popup_dialog_centered(restart_window)
	print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")

func _disable_plugin() -> void:
	remove_autoload_singleton("DiscordSDKLoader")
	FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
	remove_custom_type("DiscordSDKDebug")
	EditorInterface.get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")
	push_warning("Please restart the editor to fully disable the DiscordSDK plugin")

func save_and_restart() -> void:
	EditorInterface.save_all_scenes()
	EditorInterface.restart_editor(true)

func save_no_restart() -> void:
	EditorInterface.restart_editor(false)
	
var editor_presence: Node
func _on_editor_settings_changed() -> void:
	plugin_cfg.set_value("Discord","editor_presence",EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"))
	plugin_cfg.save(EditorInterface.get_editor_paths().get_data_dir() + plugin_data_filename)
	if ClassDB.class_exists("EditorPresence") && editor_presence == null:
		editor_presence = ClassDB.instantiate("EditorPresence")
	if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled") && EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"):
		add_child(editor_presence)
	else:
		editor_presence.queue_free()

#ERROR CODES:

Line 4:Could not resolve script "res://addons/discord-sdk-gd/nodes/debug.gd".
Line 13:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 17:Cannot call non-static function "get_editor_paths()" on the class "EditorInterface" directly. Make an instance instead.
Line 18:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 19:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 22:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 23:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 31:Cannot call non-static function "popup_dialog_centered()" on the class "EditorInterface" directly. Make an instance instead.
Line 38:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 42:Static function "save_all_scenes()" not found in base "EditorInterface".
Line 43:Cannot call non-static function "restart_editor()" on the class "EditorInterface" directly. Make an instance instead.
Line 46:Cannot call non-static function "restart_editor()" on the class "EditorInterface" directly. Make an instance instead.
Line 50:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 51:Cannot call non-static function "get_editor_paths()" on the class "EditorInterface" directly. Make an instance instead.
Line 54:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.
Line 54:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead.

Godot output

No response

Additional information

I don't know if i'm doing this correctly. I am happy to give more info if needed.

Checks

### What happened? When I tried enabling the plugin, an error occurs. Here's the error message for your reference: Unable to load addon script from path: 'res://addons/discord-sdk-gd/plugin.gd'. This might be due to a code error in that script. Disabling the addon at 'res://addons/discord-sdk-gd/plugin.cfg' to prevent further errors. ### Version 1.1.0 ### Godot Version 4.2.1 ### Exact steps to reproduce this error I downloaded it from https://godotengine.org/asset-library/asset/1855 and copied it manually. I also tried doing it automatically by using Godot's built it asset button. ### GDScript ```gdscript @tool extends EditorPlugin const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd") const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/Debug.svg") var loaded_DiscordSDKDebug = DiscordSDKDebug.new() var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate() var plugin_cfg: ConfigFile = ConfigFile.new() const plugin_data_filename = "/plugin_data.cfg" func _enter_tree() -> void: add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) EditorInterface.get_editor_settings().settings_changed.connect(_on_editor_settings_changed) func _ready() -> void: await get_tree().create_timer(0.5).timeout plugin_cfg.load(EditorInterface.get_editor_paths().get_data_dir() + plugin_data_filename) if !EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"): EditorInterface.get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",plugin_cfg.get_value("Discord","editor_presence",false)) func _exit_tree(): if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"): EditorInterface.get_editor_settings().erase("DiscordSDK/EditorPresence/enabled") func _enable_plugin() -> void: if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore") add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd") restart_window.connect("confirmed", save_no_restart) restart_window.connect("canceled", save_and_restart) EditorInterface.popup_dialog_centered(restart_window) print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!") func _disable_plugin() -> void: remove_autoload_singleton("DiscordSDKLoader") FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE) remove_custom_type("DiscordSDKDebug") EditorInterface.get_editor_settings().erase("DiscordSDK/EditorPresence/enabled") push_warning("Please restart the editor to fully disable the DiscordSDK plugin") func save_and_restart() -> void: EditorInterface.save_all_scenes() EditorInterface.restart_editor(true) func save_no_restart() -> void: EditorInterface.restart_editor(false) var editor_presence: Node func _on_editor_settings_changed() -> void: plugin_cfg.set_value("Discord","editor_presence",EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled")) plugin_cfg.save(EditorInterface.get_editor_paths().get_data_dir() + plugin_data_filename) if ClassDB.class_exists("EditorPresence") && editor_presence == null: editor_presence = ClassDB.instantiate("EditorPresence") if EditorInterface.get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled") && EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"): add_child(editor_presence) else: editor_presence.queue_free() ``` #ERROR CODES: ``` Line 4:Could not resolve script "res://addons/discord-sdk-gd/nodes/debug.gd". Line 13:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 17:Cannot call non-static function "get_editor_paths()" on the class "EditorInterface" directly. Make an instance instead. Line 18:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 19:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 22:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 23:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 31:Cannot call non-static function "popup_dialog_centered()" on the class "EditorInterface" directly. Make an instance instead. Line 38:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 42:Static function "save_all_scenes()" not found in base "EditorInterface". Line 43:Cannot call non-static function "restart_editor()" on the class "EditorInterface" directly. Make an instance instead. Line 46:Cannot call non-static function "restart_editor()" on the class "EditorInterface" directly. Make an instance instead. Line 50:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 51:Cannot call non-static function "get_editor_paths()" on the class "EditorInterface" directly. Make an instance instead. Line 54:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. Line 54:Cannot call non-static function "get_editor_settings()" on the class "EditorInterface" directly. Make an instance instead. ``` ### Godot output _No response_ ### Additional information I don't know if i'm doing this correctly. I am happy to give more info if needed. ### Checks - [X] I tried reinstalling the addon or tried to fix it myself with other methods. - [X] I tried restarting Discord and Godot completely. - [X] I did read the documentation https://github.com/vaporvee/discord-sdk-godot/wiki
shps18ppt commented 2024-01-29 14:46:12 +00:00 (Migrated from github.com)

@vaporvee Can I have the source of the original? Thanks.

@vaporvee Can I have the source of the original? Thanks.

what do you mean wich source? this project is open source and discord only gives you a closed source lib. just google Discord Game SDK but its also included as zip in this project

what do you mean wich source? this project is open source and discord only gives you a closed source lib. just google Discord Game SDK but its also included as zip in this project
shps18ppt commented 2024-01-29 14:49:34 +00:00 (Migrated from github.com)

I meant of the original message since you marked it as duplicate. sorry XD

I meant of the original message since you marked it as duplicate. sorry XD

i only have 2 open issues one is about macos and i also wrote something about it in the wiki

i only have 2 open issues one is about macos and i also wrote something about it in the wiki
https://github.com/vaporvee/discord-sdk-godot/issues/49
shps18ppt commented 2024-01-29 14:52:35 +00:00 (Migrated from github.com)

thanks! you're the best :D

thanks! you're the best :D
Sign in to join this conversation.
No description provided.