Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
TheRealFame opened this issue Aug 28, 2023 · 24 comments
Assignees
Labels
bug Something isn't working important

Comments

@TheRealFame
Copy link

TheRealFame commented Aug 28, 2023

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.
@TheRealFame TheRealFame added the bug Something isn't working label Aug 28, 2023
@vaporvee
Copy link
Owner

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

@vaporvee vaporvee changed the title [Bug/Crash]: [Bug/Crash]: Not enabling plugin correctly due to asset importing issues Aug 29, 2023
@vaporvee
Copy link
Owner

oh yeah will fix it now thank you

vaporvee added a commit that referenced this issue Aug 29, 2023
@vaporvee
Copy link
Owner

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

@TheRealFame
Copy link
Author

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?

@vaporvee
Copy link
Owner

vaporvee commented Aug 30, 2023

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

@vaporvee vaporvee reopened this Aug 30, 2023
@vaporvee
Copy link
Owner

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

@TheRealFame
Copy link
Author

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

@TheRealFame
Copy link
Author

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

@vaporvee
Copy link
Owner

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

@vaporvee
Copy link
Owner

Give me the exact issue you are getting

@TheRealFame
Copy link
Author

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..

@vaporvee
Copy link
Owner

what do you mean??

@TheRealFame
Copy link
Author

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

@vaporvee
Copy link
Owner

vaporvee commented Sep 1, 2023

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

@vaporvee vaporvee closed this as completed Sep 1, 2023
@TheRealFame
Copy link
Author

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..

@vaporvee
Copy link
Owner

vaporvee commented Sep 4, 2023

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

@vaporvee
Copy link
Owner

vaporvee commented Sep 4, 2023

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

@vaporvee
Copy link
Owner

vaporvee commented Sep 4, 2023

and instanced is not what you think it is

@TheRealFame
Copy link
Author

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

@vaporvee
Copy link
Owner

vaporvee commented Sep 5, 2023

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

@vaporvee vaporvee changed the title [Bug/Crash]: Not enabling plugin correctly due to asset importing issues [Bug/Crash]: Not enabling plugin correctly due to asset importing issues and not understanding how the plugin works Sep 5, 2023
@vaporvee
Copy link
Owner

vaporvee commented Sep 5, 2023

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

@vaporvee vaporvee reopened this Sep 5, 2023
@vaporvee
Copy link
Owner

vaporvee commented Sep 8, 2023

@TheRealFame does it work now?

@TheRealFame
Copy link
Author

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
Copy link
Author

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working important
Projects
None yet
Development

No branches or pull requests

2 participants