Using Plugins
How to install and use plugins in Wonderland Editor.
Enabling Plugins
For this reason plugin execution is disabled by default for every project until you
confirm plugin execution in Project Settings > Enable plugins
.
Only enable plugins for projects you trust. If you move or rename your project, you will need to re-enable plugins.
Installing Plugins
There are two ways to install plugins: via your project dependencies or as files in the plugins
folder.
Via NPM
You can install plugins via the node package manager (NPM). Install a plugin with the following command:
1npm i --save-dev @wonderlandengine/plugin-cleanup-resources
Replace @wonderlandengine/plugin-cleanup-resources
with any plugin you want to install.
Running this command will create a new entry in the devDependencies
section of your package.json
file.
The plugin will then appear in Project Settings > Plugins
.
Managing Plugins
Sometimes you want to disable plugins to reduce UI clutter or to restore editor performance.
The list in Project Settings > Plugins
shows which plugins are installed and available
to be enabled.
Development
Creating plugins is easy. You have three methods available:
Plugin Script
A single script that can share dependencies with your main project package.json
.
We recommend you install any plugin-related dependencies as devDependencies
(using --save-dev
).
You can create a new plugin by creating the plugins
folder in your project’s root, then
right-click > New Plugin
.
Make sure to install the @wonderlandengine/editor-api
package in your project root:
1npm i --save-dev @wonderlandengine/editor-api
Plugin Directory
Similarly to Plugin Scripts, create a plugins
subfolder first,
but then create yet another subfolder that you name according to your plugin.
In this folder you can create a new package.json
file (e.g. via npm init
).
Make sure to install the @wonderlandengine/editor-api
package in that directory:
1npm i --save @wonderlandengine/editor-api
Note, --save
instead of --save-dev
, as you are not installing into your Wonderland Engine
project, but into a separate plugin project.
Plugin Package
If you want to share and distribute your plugin, you can npm init
in a separate folder, and add
the "wonderlandengine"
key to your package.json
.
Make sure to install the @wonderlandengine/editor-api
package in that directory:
1npm i --save @wonderlandengine/editor-api
To use this local plugin in your project, npm i --save-dev <path-to-the-directory>
,
or publish it when ready and install it via the package, see Installing.