[Bug/Crash]: Not enabling plugin correctly due to asset importing issues and not understanding how the plugin works #36

Closed
opened 2023-08-28 23:42:21 +00:00 by TheRealFame · 24 comments
TheRealFame commented 2023-08-28 23:42:21 +00:00 (Migrated from github.com)

What happened?

A bug happened! (Lol)
I seem to be getting this error from the script! That. And i cannot turn on the plugin- I am on godot 4.1
image

Version

3.1

Godot Version

4.1.1 stable

GDScript

@tool
extends EditorPlugin

const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Debug.svg")
var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
var restart_window: Control = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate()


func _enter_tree() -> void:
	add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
	add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd")
	ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false)
	ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
	ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false)
	ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true)

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")
	if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore"):
		DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore")
	add_control_to_container(EditorPlugin.CONTAINER_TOOLBAR,restart_window)
	restart_window.get_child(0).connect("canceled",save_restart)
	restart_window.get_child(0).connect("confirmed",restart)

func _disable_plugin() -> void:
	FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
	FileAccess.open("res://addons/discord-sdk-gd/nodes/.gdignore",FileAccess.WRITE)
	push_warning("DiscordSDK Addon got disabled. PLEASE RESTART THE EDITOR!")
	remove_autoload_singleton("DiscordSDKLoader")
	remove_custom_type("DiscordSDKDebug")
	ProjectSettings.clear("DiscordSDK/EditorPresence/enabled")

func save_restart() -> void:
	get_editor_interface().restart_editor(true)

func restart() -> void:
	get_editor_interface().restart_editor(false)

Godot output

Line 5:Could not preload resource file "res://addons/discord-sdk-gd/nodes/assets/Debug.svg".
Line 5:Could not resolve type for constant "DiscordSDKDebug_icon".

Additional information

No response

Checks

  • I tried reinstalling the addon or tried to fix it myself with other methods.
  • I tried restarting Discord and Godot completely.
### What happened? A bug happened! (Lol) I seem to be getting this error from the script! That. And i cannot turn on the plugin- I am on godot 4.1 ![image](https://github.com/vaporvee/discord-sdk-godot/assets/29516927/00faa96c-55c7-43ac-aa02-d61d7cff8278) ### Version 3.1 ### Godot Version 4.1.1 stable ### 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/nodes/assets/Debug.svg") var loaded_DiscordSDKDebug = DiscordSDKDebug.new() var restart_window: Control = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate() func _enter_tree() -> void: add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd") ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true) ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true) 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") if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore"): DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/nodes/.gdignore") add_control_to_container(EditorPlugin.CONTAINER_TOOLBAR,restart_window) restart_window.get_child(0).connect("canceled",save_restart) restart_window.get_child(0).connect("confirmed",restart) func _disable_plugin() -> void: FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE) FileAccess.open("res://addons/discord-sdk-gd/nodes/.gdignore",FileAccess.WRITE) push_warning("DiscordSDK Addon got disabled. PLEASE RESTART THE EDITOR!") remove_autoload_singleton("DiscordSDKLoader") remove_custom_type("DiscordSDKDebug") ProjectSettings.clear("DiscordSDK/EditorPresence/enabled") func save_restart() -> void: get_editor_interface().restart_editor(true) func restart() -> void: get_editor_interface().restart_editor(false) ``` ### Godot output ```shell Line 5:Could not preload resource file "res://addons/discord-sdk-gd/nodes/assets/Debug.svg". Line 5:Could not resolve type for constant "DiscordSDKDebug_icon". ``` ### Additional information _No response_ ### Checks - [x] I tried reinstalling the addon or tried to fix it myself with other methods. - [X] I tried restarting Discord and Godot completely.

oh yeah that could actually be an issue with moving assets let me check

oh yeah that could actually be an issue with moving assets let me check

oh yeah will fix it now thank you

oh yeah will fix it now thank you

fixed in a57c781 go download the new release either from github or the assets store (same download source)

fixed in a57c781 go download the new release either from github or the assets store (same download source)
TheRealFame commented 2023-08-30 00:13:51 +00:00 (Migrated from github.com)

Yeah uh. The addon does not work on exported, or in editor. Is there any fixes for the client side i have to do? Or does the plugin not work for others in general as well?

Yeah uh. The addon does not work on exported, or in editor. Is there any fixes for the client side i have to do? Or does the plugin not work for others in general as well?

it should work in editor so when its not working on both thats weird it works in a fresh project. I'll test if it works on exported

it should work in editor so when its not working on both thats weird it works in a fresh project. I'll test if it works on exported

works perfectly on a fresh project directly from the asset library on both editor and exported project... what exavtly is happening

works perfectly on a fresh project directly from the asset library on both editor and exported project... what exavtly is happening
TheRealFame commented 2023-08-30 18:02:32 +00:00 (Migrated from github.com)

I'll take a look at it on a completely empty project then 😅 hopefully it's not an issue with godot

I'll take a look at it on a completely empty project then 😅 hopefully it's not an issue with godot
TheRealFame commented 2023-08-30 21:03:35 +00:00 (Migrated from github.com)

Addon-Test.zip
Here is my project folder. The addon is not working at all.

[Addon-Test.zip](https://github.com/vaporvee/discord-sdk-godot/files/12480174/Addon-Test.zip) Here is my project folder. The addon is not working at all.

For me it works just fine but you know you have to write actual code to run it right? https://github.com/vaporvee/discord-sdk-godot/wiki#quick-start

For me it works just fine but you know you have to write actual code to run it right? https://github.com/vaporvee/discord-sdk-godot/wiki#quick-start

Give me the exact issue you are getting

Give me the exact issue you are getting
TheRealFame commented 2023-08-31 15:58:25 +00:00 (Migrated from github.com)

Oh- I just load up the game, check in discord to see if the status appeared but it seems to not have popped up every time- didn't know it doesn't auto start..

Oh- I just load up the game, check in discord to see if the status appeared but it seems to not have popped up every time- didn't know it doesn't auto start..

what do you mean??

what do you mean??
TheRealFame commented 2023-08-31 21:36:36 +00:00 (Migrated from github.com)

Oh? You said I had to write code to get it up? I had only been applying the addon and launching the game hoping that the rich presence would just pop up and show in actual discord- not much else was done then just running the addon on a empty and filled project

Oh? You said I had to write code to get it up? I had only been applying the addon and launching the game hoping that the rich presence would just pop up and show in actual discord- not much else was done then just running the addon on a empty and filled project

yeah okay just do the actual quick start
https://github.com/vaporvee/discord-sdk-godot/wiki#quick-start

yeah okay just do the actual quick start https://github.com/vaporvee/discord-sdk-godot/wiki#quick-start
TheRealFame commented 2023-09-02 04:19:28 +00:00 (Migrated from github.com)

image
Loaded up the debug scene. And it shows it is not instanced.. But how would i instance it if it's supposed to be running already? Either way.. It seems to have no clue what all of these are connected to, Do you know if i am missing anything? I modified both the core updater, and example script- There is not much else i can modify or change..

![image](https://github.com/vaporvee/discord-sdk-godot/assets/29516927/4a592ddd-1864-43fa-b459-32ff642f676c) Loaded up the debug scene. And it shows it is not instanced.. But how would i instance it if it's supposed to be running already? Either way.. It seems to have no clue what all of these are connected to, Do you know if i am missing anything? I modified both the core updater, and example script- There is not much else i can modify or change..

do not modify the plugin just do the quick setup the debug node is supposed to be used when you wrote your own script file

do not modify the plugin just do the quick setup the debug node is supposed to be used when you wrote your own script file

You have to write the code i literally made a step by step guide

You have to write the code i literally made a step by step guide

and instanced is not what you think it is

and instanced is not what you think it is
TheRealFame commented 2023-09-04 18:13:41 +00:00 (Migrated from github.com)

Oh. I see, Then I'll try this again without modifications, but I believe the same thing is just gonna happen..

Oh. I see, Then I'll try this again without modifications, but I believe the same thing is just gonna happen..

Nope you have to write your own file with your own values just do it the exact way in the wiki it works for everyone i asked. even in a bigger game I'm working with

Nope you have to write your own file with your own values just do it the exact way in the wiki it works for everyone i asked. even in a bigger game I'm working with

You can also look at the testing project
https://github.com/vaporvee/discord-sdk-godot/tree/main/project

You can also look at the testing project https://github.com/vaporvee/discord-sdk-godot/tree/main/project

@TheRealFame does it work now?

@TheRealFame does it work now?
TheRealFame commented 2023-09-08 09:54:24 +00:00 (Migrated from github.com)

Ahh, I haven't launched Godot for awhile. So I guess I'll try the sample project and see if it works/auto starts

Ahh, I haven't launched Godot for awhile. So I guess I'll try the sample project and see if it works/auto starts
TheRealFame commented 2023-09-13 23:28:42 +00:00 (Migrated from github.com)

I had to also enable it in project settings. Which i did not check for that time, So thank god i checked today. I was only trying to see if godot had adopted any new rendering apis

I had to also enable it in project settings. Which i did not check for that time, So thank god i checked today. I was only trying to see if godot had adopted any new rendering apis
Sign in to join this conversation.
No description provided.