Installation and Sharing
If you want to apply the extension to all projects, you can put the extension package under the Global path:
- Windows:
- macOS:
$HOME/.CocosCreator/extensions
If you only want to apply the extension to the specified project, you can put the extension package under the Project path:
$Your project address/extensions
After writing an extension, if you want to share the extension with others, you need to compress the extension package.
For example, the directory structure of the extension package hello-world
, if placed in the project extension package path, is as follows:
The content format of the hello-world.zip
is the same as the file format of hello-world
.
|--package.json
|--browser.js
First, click Extension -> Extension Manager in the top menu bar of the editor to open the Extension Manager panel.
Finally, find the extension in the Project/Global tab of the Extension Manager panel, click the Enable button on the right, and the extension you just imported will run normally.
Find the extension that needs to be deleted in the Extension Manager panel, click the “Delete” icon button, and the folder where the extension is located will be deleted as well. If you only need to disable the extension, you can just select the “Disable” button on the right.
During the development process, sometimes it is necessary to modify the content of the extension, but after the modification, the logic of the extension will not be automatically updated. At this point it is necessary to reload the extension manually in the editor.
Find the corresponding extension in the Extension Manager panel and click the “Reload” icon button, and the extension in the editor will be re-run with the latest code and files.