Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Tags de fonctionnalité
Introduction
Godot a un système spécial pour marquer la disponibilité des fonctionnalités. Chaque fonctionnalité est représentée par une chaîne de caractères, qui peut se référer à plusieurs des éléments suivants :
Nom de la plate-forme.
Architecture de plate-forme (64 bits ou 32 bits, x86 ou ARM).
Type de plate-forme (bureau, mobile, Web).
Algorithme de compression de texture supportée par la plateforme.
Qu'il s'agisse d'une compilation de débogage
debugou de productionrelease(debuginclut l'éditeur).Si le projet est exécuté à partir de l'éditeur ou d'un fichier binaire "autonome".
Et bien d'autres choses.
Features can be queried at runtime from the singleton API by calling:
OS.has_feature(name)
OS.HasFeature(name);
OS feature tags are used by GDExtension to determine which libraries to load.
For example, a library for linux.debug.editor.x86_64 will be
loaded only on a debug editor build for Linux x86_64.
Fonctionnalités par défaut
Voici une liste de la plupart des tags de fonctionnalités de Godot. Gardez à l'esprit qu'ils sont sensibles à la casse :
Tag de fonctionnalité |
Description |
|---|---|
android |
Running on Android (but not within a Web browser) |
bsd |
Running on *BSD (but not within a Web browser) |
linux |
Running on Linux (but not within a Web browser) |
macos |
Running on macOS (but not within a Web browser) |
ios |
Running on iOS (but not within a Web browser) |
visionos |
Running on visionOS (but not within a Web browser) |
Windows |
Éxécution sur Windows |
linuxbsd |
Running on Linux or *BSD |
debug |
Exécution sur un binaire de débogage |
release |
Éxécution sur un binaire de déploiement |
editor |
Exécuter sur une compilation éditeur |
editor_hint |
Running on an editor build, and inside the editor |
editor_runtime |
Running on an editor build, and running the project |
template |
Running on a non-editor (export template) build |
double |
Running on a double-precision build |
single |
Running on a single-precision build |
64 |
Exécution sur une version 64-bits (toutes architectures) |
32 |
Éxécution sur une version 32-bits (toutes architectures) |
x86_64 |
Exécution sur une compilation 64 bits x86 |
x86_32 |
Exécution sur une version 32 bits x86 |
x86 |
Running on an x86 build (any bitness) |
arm64 |
Exécution sur une compilation 64 bits d'ARM |
arm32 |
Exécution sur une version 32 bits ARM |
arm |
Running on an ARM build (any bitness) |
rv64 |
Running on a 64-bit RISC-V build |
riscv |
Running on a RISC-V build (any bitness) |
ppc64 |
Running on a 64-bit PowerPC build |
ppc32 |
Running on a 32-bit PowerPC build |
ppc |
Running on a PowerPC build (any bitness) |
wasm64 |
Running on a 64-bit WebAssembly build (not yet possible) |
wasm32 |
Exécution sur une version 32 bits WebAssembly |
wasm |
Running on a WebAssembly build (any bitness) |
mobile |
L’OS hôte est une plateforme mobile |
pc |
L’OS hôte est une plateforme PC (bureau/ordinateu portable) |
web |
L’OS hôte est un serveur web |
nothreads |
Running without threading support |
threads |
Running with threading support |
web_android |
Host OS is a Web browser running on Android |
web_ios |
Host OS is a Web browser running on iOS |
web_linuxbsd |
Host OS is a Web browser running on Linux or *BSD |
web_macos |
Host OS is a Web browser running on macOS |
web_windows |
Host OS is a Web browser running on Windows |
etc |
Les textures utllisant une compression ETC1 sont supportées |
etc2 |
Les textures utllisant une compression ETC2 sont supportées |
s3tc |
Les textures utllisant une compression S3TC (DXT/BC) sont supportées |
movie |
Le mode Création de film est actif |
shader_baker |
Project was exported with shader baking enabled (only applies to the exported project, not when running in the editor) |
dedicated_server |
Project was exported as a dedicated server (only applies to the exported project, not when running in the editor) |
Avertissement
With the exception of texture compression, web_<platform> and
movie feature tags, default feature tags are immutable.
This means that they will not change depending on runtime conditions.
For example, OS.has_feature("mobile") will return false
when running a project exported to Web on a mobile device.
To check whether a project exported to Web is running on a mobile device,
use OS.has_feature("web_android") or OS.has_feature("web_ios").
Fonctionnalités personnalisées
Il est possible d'ajouter des fonctionnalités personnalisées à une compilation, il suffit d'utiliser le champ correspondant dans le préréglage d'exportation utilisé pour le générer :
Note
Les balises de fonctionnalité personnalisées sont uniquement utilisées lors de l'exécution du projet exporté (y compris avec Déploiement en un clic). Ils ne sont pas utilisés lors de l'exécution du projet à partir de l'éditeur, même si le préréglage d'exportation marqué comme Runnable pour votre plate-forme actuelle a des balises de fonctionnalité personnalisées définies.
Custom feature tags are also not used in EditorExportPlugin scripts. Instead, feature tags in EditorExportPlugin will reflect the device the editor is currently running on.
Écraser les paramètres du projet
Des fonctionnalités peuvent être utilisées pour remplacer des valeurs de configuration spécifiques dans les paramètres du projet. Cela permet de mieux personnaliser n'importe quelle configuration lors d'une compilation.
Dans l'exemple suivant, une icône différente est ajoutée pour la compilation de la démo du jeu (qui a été personnalisé dans un préréglage d'exportation spécial, qui, à son tour, n'inclut que des niveaux de démo).
The desired configuration is selected, which effectively copies its properties to the panel above (1). The "demo_build" feature tag is selected (2). The configuration is added to the project settings (3).
Après écrasement, un nouveau champ est ajouté pour cette configuration spécifique.
Note
Lorsque vous utilisez la fonctionnalité paramètres de projet "override.cfg" (qui n'est pas liée aux balises de fonctionnalité), n'oubliez pas que les balises de fonctionnalité s'appliquent toujours. Par conséquent, veillez à également remplacer le paramètre par la ou les balises de fonctionnalité souhaitées si vous voulez qu'elles remplacent les paramètres de base du projet sur toutes les plateformes et configurations.
Écrasements par défaut
Il y a déjà beaucoup de paramètres qui sont fournis avec des remplacements par défaut, ils peuvent être trouvés dans de nombreuses sections des paramètres du projet.
Taking feature tags into account when reading project settings
By default, feature tags are not taken into account when reading project settings using the typical approaches (ProjectSettings.get_setting or ProjectSettings.get). Instead, you must use ProjectSettings.get_setting_with_override.
For example, with the following project settings:
[section]
subsection/example = "Release"
subsection/example.debug = "Debug"
Using ProjectSettings.get_setting("section/subsection/example") will return
"Release" regardless of whether a debug build is currently running. On the
other hand, ProjectSettings.get_setting_with_override("section/subsection/example")
will obey feature tags and will return "Debug" if using a debug build.
Personnalisation de la compilation
Feature tags can be used to customize a build process too, by writing a custom ExportPlugin. They are also used to specify which shared library is loaded and exported in GDExtension.