Skip to content

Commit

Permalink
autoload setup now only on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandra Bullock authored and Sandra Bullock committed May 13, 2024
1 parent a0fb10a commit 8120400
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 8 additions & 2 deletions addons/AndroidInternetConnectionStatePlugin/export_plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ var export_plugin: AndroidInternetConnectionStateClass
func _enter_tree():
export_plugin = load("res://addons/AndroidInternetConnectionStatePlugin/AndroidInternetConnectionStateClass.gd").new(_plugin_name)
add_export_plugin(export_plugin)
add_autoload_singleton(_plugin_name, "res://addons/AndroidInternetConnectionStatePlugin/export_plugin.gd")

if OS.get_name() == "Android":
add_autoload_singleton(_plugin_name, "res://addons/AndroidInternetConnectionStatePlugin/export_plugin.gd")
else:
push_warning("AndroidInternetConnectionStatePlugin is available only at Android platform, the autoload has not beed registered")


func _exit_tree():
remove_export_plugin(export_plugin)
export_plugin = null
remove_autoload_singleton(_plugin_name)

if ProjectSettings.has_setting("autoload/" + _plugin_name):
remove_autoload_singleton(_plugin_name)

4 changes: 0 additions & 4 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ run/main_scene="res://example/test.tscn"
config/features=PackedStringArray("4.2", "Mobile")
config/icon="res://icon.png"

[autoload]

AndroidInternetConnectionStatePlugin="*res://addons/AndroidInternetConnectionStatePlugin/export_plugin.gd"

[editor_plugins]

enabled=PackedStringArray("res://addons/AndroidInternetConnectionStatePlugin/plugin.cfg")
Expand Down

0 comments on commit 8120400

Please sign in to comment.