unity-module-scripts
v1.0.1
Published
Common package scripts for Unity modules built using the npm ecosystem
Downloads
4
Readme
unity-module-scripts
Common package scripts for Unity modules built using the Node.js / npm ecosystem. To understand why this might be a good idea, you should read this detailed explanation.
Prerequisites
Install Node.js for your platform and restart your session such that node
and npm
are on PATH
.
Usage
For a Unity module with an existing package.json
, install unity-module-scripts
:
npm install unity-module-scripts --save
Configure package.json
for your postinstall
and postuninstall
steps:
"scripts": {
"postinstall": "node pkg-scripts/postinstall.js",
"postuninstall": "node pkg-scripts/postuninstall.js"
},
Add pkg-scripts/postinstall.js
to your module:
'use strict'
var pkg = require('../package.json')
var path = require('path')
var umscripts = require('unity-module-scripts')
umscripts.simplePostInstall(pkg.name, path.resolve(__dirname, '..'))
Add pkg-scripts/postuninstall.js
to your module:
'use strict'
var pkg = require('../package.json')
var path = require('path')
var umscripts = require('unity-module-scripts')
umscripts.simplePostUninstall(pkg.name, path.resolve(__dirname, '..'))
When added as a dependency to an existing Unity solution, your package will now be installed into the Assets/Modules/<package_name>
directory and automatically be imported into the editor.
For a new package, it may be a good idea to start with this boilerplate module. Happy hacking!
License
See LICENSE.