Table of Contents

Class EditorExportPlugin

Namespace
Godot
Assembly
GodotSharpEditor.dll

EditorExportPlugins are automatically invoked whenever the user exports the project. Their most common use is to determine what files are being included in the exported project. For each plugin, _ExportBegin(string[], bool, string, uint) is called at the beginning of the export process and then _ExportFile(string, string, string[]) is called for each exported file.

To use EditorExportPlugin, register it using the AddExportPlugin(EditorExportPlugin) method first.

public class EditorExportPlugin : RefCounted, IDisposable
Inheritance
EditorExportPlugin
Implements
Inherited Members

Constructors

EditorExportPlugin()

public EditorExportPlugin()

Methods

AddFile(string, byte[], bool)

Adds a custom file to be exported. path is the virtual path that can be used to load the file, file is the binary data of the file.

When called inside _ExportFile(string, string, string[]) and remap is true, the current file will not be exported, but instead remapped to this custom file. remap is ignored when called in other places.

public void AddFile(string path, byte[] file, bool remap)

Parameters

path string
file byte[]
remap bool

AddIosBundleFile(string)

Adds an iOS bundle file from the given path to the exported project.

public void AddIosBundleFile(string path)

Parameters

path string

AddIosCppCode(string)

Adds a C++ code to the iOS export. The final code is created from the code appended by each active export plugin.

public void AddIosCppCode(string code)

Parameters

code string

AddIosEmbeddedFramework(string)

Adds a dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project and embeds it into resulting binary.

Note: For static libraries (*.a) works in same way as AddIosFramework(string).

Note: This method should not be used for System libraries as they are already present on the device.

public void AddIosEmbeddedFramework(string path)

Parameters

path string

AddIosFramework(string)

Adds a static library (*.a) or dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project.

public void AddIosFramework(string path)

Parameters

path string

AddIosLinkerFlags(string)

Adds linker flags for the iOS export.

public void AddIosLinkerFlags(string flags)

Parameters

flags string

AddIosPlistContent(string)

Adds content for iOS Property List files.

public void AddIosPlistContent(string plistContent)

Parameters

plistContent string

AddIosProjectStaticLib(string)

Adds a static lib from the given path to the iOS project.

public void AddIosProjectStaticLib(string path)

Parameters

path string

AddMacOSPluginFile(string)

Adds file or directory matching path to PlugIns directory of macOS app bundle.

Note: This is useful only for macOS exports.

public void AddMacOSPluginFile(string path)

Parameters

path string

AddSharedObject(string, string[], string)

Adds a shared object or a directory containing only shared objects with the given tags and destination path.

Note: In case of macOS exports, those shared objects will be added to Frameworks directory of app bundle.

In case of a directory code-sign will error if you place non code object in directory.

public void AddSharedObject(string path, string[] tags, string target)

Parameters

path string
tags string[]
target string

GetOption(StringName)

Returns the current value of an export option supplied by _GetExportOptions(EditorExportPlatform).

public Variant GetOption(StringName name)

Parameters

name StringName

Returns

Variant

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

Skip()

To be called inside _ExportFile(string, string, string[]). Skips the current file, so it's not included in the export.

public void Skip()

_BeginCustomizeResources(EditorExportPlatform, string[])

Return true if this plugin will customize resources based on the platform and features used.

When enabled, _GetCustomizationConfigurationHash(), _CustomizeResource(Resource, string) and _CustomizeScene(Node, string) will be called and must be implemented.

public virtual bool _BeginCustomizeResources(EditorExportPlatform platform, string[] features)

Parameters

platform EditorExportPlatform
features string[]

Returns

bool

_BeginCustomizeScenes(EditorExportPlatform, string[])

Return true if this plugin will customize scenes based on the platform and features used.

public virtual bool _BeginCustomizeScenes(EditorExportPlatform platform, string[] features)

Parameters

platform EditorExportPlatform
features string[]

Returns

bool

_CustomizeResource(Resource, string)

Customize a resource. If changes are made to it, return the same or a new resource. Otherwise, return null.

The path argument is only used when customizing an actual file, otherwise this means that this resource is part of another one and it will be empty.

Implementing this method is required if _BeginCustomizeResources(EditorExportPlatform, string[]) returns true.

public virtual Resource _CustomizeResource(Resource resource, string path)

Parameters

resource Resource
path string

Returns

Resource

_CustomizeScene(Node, string)

Customize a scene. If changes are made to it, return the same or a new scene. Otherwise, return null. If a new scene is returned, it is up to you to dispose of the old one.

Implementing this method is required if _BeginCustomizeScenes(EditorExportPlatform, string[]) returns true.

public virtual Node _CustomizeScene(Node scene, string path)

Parameters

scene Node
path string

Returns

Node

_EndCustomizeResources()

This is called when the customization process for resources ends.

public virtual void _EndCustomizeResources()

_EndCustomizeScenes()

This is called when the customization process for scenes ends.

public virtual void _EndCustomizeScenes()

_ExportBegin(string[], bool, string, uint)

Virtual method to be overridden by the user. It is called when the export starts and provides all information about the export. features is the list of features for the export, isDebug is true for debug builds, path is the target path for the exported project. flags is only used when running a runnable profile, e.g. when using native run on Android.

public virtual void _ExportBegin(string[] features, bool isDebug, string path, uint flags)

Parameters

features string[]
isDebug bool
path string
flags uint

_ExportEnd()

Virtual method to be overridden by the user. Called when the export is finished.

public virtual void _ExportEnd()

_ExportFile(string, string, string[])

Virtual method to be overridden by the user. Called for each exported file, providing arguments that can be used to identify the file. path is the path of the file, type is the Resource represented by the file (e.g. PackedScene) and features is the list of features for the export.

Calling Skip() inside this callback will make the file not included in the export.

public virtual void _ExportFile(string path, string type, string[] features)

Parameters

path string
type string
features string[]

_GetAndroidDependencies(EditorExportPlatform, bool)

Virtual method to be overridden by the user. This is called to retrieve the set of Android dependencies provided by this plugin. Each returned Android dependency should have the format of an Android remote binary dependency: org.godot.example:my-plugin:0.0.0

For more information see Android documentation on dependencies.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.

public virtual string[] _GetAndroidDependencies(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string[]

_GetAndroidDependenciesMavenRepos(EditorExportPlatform, bool)

Virtual method to be overridden by the user. This is called to retrieve the URLs of Maven repositories for the set of Android dependencies provided by this plugin.

For more information see Gradle documentation on dependency management.

Note: Google's Maven repo and the Maven Central repo are already included by default.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.

public virtual string[] _GetAndroidDependenciesMavenRepos(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string[]

_GetAndroidLibraries(EditorExportPlatform, bool)

Virtual method to be overridden by the user. This is called to retrieve the local paths of the Android libraries archive (AAR) files provided by this plugin.

Note: Relative paths must be relative to Godot's res://addons/ directory. For example, an AAR file located under res://addons/hello_world_plugin/HelloWorld.release.aar can be returned as an absolute path using res://addons/hello_world_plugin/HelloWorld.release.aar or a relative path using hello_world_plugin/HelloWorld.release.aar.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.

public virtual string[] _GetAndroidLibraries(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string[]

_GetAndroidManifestActivityElementContents(EditorExportPlatform, bool)

Virtual method to be overridden by the user. This is used at export time to update the contents of the activity element in the generated Android manifest.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.

public virtual string _GetAndroidManifestActivityElementContents(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string

_GetAndroidManifestApplicationElementContents(EditorExportPlatform, bool)

Virtual method to be overridden by the user. This is used at export time to update the contents of the application element in the generated Android manifest.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.

public virtual string _GetAndroidManifestApplicationElementContents(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string

_GetAndroidManifestElementContents(EditorExportPlatform, bool)

Virtual method to be overridden by the user. This is used at export time to update the contents of the manifest element in the generated Android manifest.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.

public virtual string _GetAndroidManifestElementContents(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string

_GetCustomizationConfigurationHash()

Return a hash based on the configuration passed (for both scenes and resources). This helps keep separate caches for separate export configurations.

Implementing this method is required if _BeginCustomizeResources(EditorExportPlatform, string[]) returns true.

public virtual ulong _GetCustomizationConfigurationHash()

Returns

ulong

_GetExportFeatures(EditorExportPlatform, bool)

Return a string[] of additional features this preset, for the given platform, should have.

public virtual string[] _GetExportFeatures(EditorExportPlatform platform, bool debug)

Parameters

platform EditorExportPlatform
debug bool

Returns

string[]

_GetExportOptionWarning(EditorExportPlatform, string)

Check the requirements for the given option and return a non-empty warning string if they are not met.

Note: Use GetOption(StringName) to check the value of the export options.

public virtual string _GetExportOptionWarning(EditorExportPlatform platform, string option)

Parameters

platform EditorExportPlatform
option string

Returns

string

_GetExportOptions(EditorExportPlatform)

Return a list of export options that can be configured for this export plugin.

Each element in the return value is a Dictionary with the following keys:

- option: A dictionary with the structure documented by GetPropertyList(), but all keys are optional.

- default_value: The default value for this option.

- update_visibility: An optional boolean value. If set to true, the preset will emit PropertyListChanged when the option is changed.

public virtual Array<Dictionary> _GetExportOptions(EditorExportPlatform platform)

Parameters

platform EditorExportPlatform

Returns

Array<Dictionary>

_GetName()

Return the name identifier of this plugin (for future identification by the exporter). The plugins are sorted by name before exporting.

Implementing this method is required.

public virtual string _GetName()

Returns

string

_ShouldUpdateExportOptions(EditorExportPlatform)

Return true, if the result of _GetExportOptions(EditorExportPlatform) has changed and the export options of preset corresponding to platform should be updated.

public virtual bool _ShouldUpdateExportOptions(EditorExportPlatform platform)

Parameters

platform EditorExportPlatform

Returns

bool

_SupportsPlatform(EditorExportPlatform)

Return true if the plugin supports the given platform.

public virtual bool _SupportsPlatform(EditorExportPlatform platform)

Parameters

platform EditorExportPlatform

Returns

bool