Skip to content

Template for Godot plugins that target the Android and iOS platforms and provide a common GDScript interface.

License

Notifications You must be signed in to change notification settings

godot-mobile-plugins/godot-plugin-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

      




Template Initialization


Run the init.sh script in order to initialize the repository.

How To Run init.sh

Use the -n option to rename plugin:

$ godot-plugin-template > ./script/init.sh -n NameOfYourPlugin

Example:

$ godot-plugin-template > ./script/init.sh -n NativeCamera

Dry Run init.sh

Use the -d option to dry-run init.sh:

$ godot-plugin-template > ./script/init.sh -n NameOfYourPlugin -d

The dry-run will show what would be done without making changes.













Godot Plugin Template Plugin

A Godot plugin that provides a unified GDScript interface for getting information on mobile device connections on Android and iOS.

Key Features:

  • Get information about all available connections on a mobile device
  • Know when a new connection is established (signal)
  • Know when a connection is lost (signal)

Table of Contents


Installation

Before installing this plugin, make sure to uninstall any previous versions of the same plugin.

If installing both Android and iOS versions of the plugin in the same project, then make sure that both versions use the same addon interface version.

There are 2 ways to install the PluginTemplate plugin into your project:

  • Through the Godot Editor's AssetLib
  • Manually by downloading archives from Github

Installing via AssetLib

Steps:

  • search for and select the PluginTemplate plugin in Godot Editor
  • click Download button
  • on the installation dialog...
    • keep Change Install Folder setting pointing to your project's root directory
    • keep Ignore asset root checkbox checked
    • click Install button
  • enable the plugin via the Plugins tab of Project->Project Settings... menu, in the Godot Editor

Installing both Android and iOS versions of the plugin in the same project

When installing via AssetLib, the installer may display a warning that states "[x number of] files conflict with your project and won't be installed." You can ignore this warning since both versions use the same addon code.

Installing manually

Steps:

  • download release archive from Github
  • unzip the release archive
  • copy to your Godot project's root directory
  • enable the plugin via the Plugins tab of Project->Project Settings... menu, in the Godot Editor

Usage

Add PluginTemplate node to your main scene or an autoload global scene.

  • use the PluginTemplate node's get_plugin_template() method to get information on all available connections
  • connect PluginTemplate node signals
    • connection_established(a_connection_info: ConnectionInfo)
    • connection_lost(a_connection_info: ConnectionInfo)

Example usage:

@onready var plugin_template := $PluginTemplate

func _ready():
	plugin_template.connection_established.connect(_on_connection_established)
	plugin_template.connection_lost.connect(_on_connection_lost)

	var connections: Array[ConnectionInfo] = plugin_template.get_plugin_template()
	for info in connections:
		print("Connection type: %s -- is_active: %s -- is_metered: %s" % [
				ConnectionInfo.ConnectionType.keys()[info.get_connection_type()],
				str(info.is_active()),
				str(info.is_metered())])

func _on_connection_established(info: ConnectionInfo):
	print("Connection established:", info.connection_type)

func _on_connection_lost(info: ConnectionInfo):
	print("Connection lost:", info.connection_type)

Signals

  • register listeners to the following signals of the PluginTemplate node:
    • connection_established(a_connection_info: ConnectionInfo)
    • connection_lost(a_connection_info: ConnectionInfo)

Methods

  • get_plugin_template() -> Array[ConnectionInfo] - returns an array of ConnectionInfo objects

Classes

ConnectionInfo

  • Encapsulates network connection data that is provided by the mobile OS.
  • Properties:
    • connection_type: type of network connection: WIFI, Cellular, Ethernet, Bluetooth, VPN, Loopback, or Unknown
    • is_active: whether the connection is actively being used
    • is_metered: whether the connection has a data limit that tracks usage

Platform-Specific Notes

Android

iOS


Links


All Plugins

Plugin Android iOS Free Open Source License
Notification Scheduler MIT
Admob MIT
Deeplink MIT
Share MIT
In-App Review MIT
Plugin Template MIT
OAuth 2.0 MIT

Credits

Developed by Your Name

Original repository: Godot Plugin Template Plugin


Contributing

See our guide if you would like to contribute to this project.

About

Template for Godot plugins that target the Android and iOS platforms and provide a common GDScript interface.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •