Skip to content

hxhieu/playcanvas-typescript-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

playcanvas-typescript-template

Minimal setup to set up a local PlayCanvas development using TypeScript.

This works with my other parcel plugin parcel-plugin-playcanvas for a seamless local <-> PlayCanvas Editor workflow.

How to use

  • Clone this repo
  • npm install or yarn install to pull the dependencies
  • npm run serve or yarn serve for development, .ts files are watched and rebundle and upload to PlayCanvas automatically
  • npm build for a production build

Example usage

import { createScript } from "../../extensions/create-script-decorator"
import { ScriptTypeBase } from "../../extensions/script-type-base"
import { IAttributeCollection } from "../../@types"

@createScript()
export class HelloWorld extends ScriptTypeBase implements pc.ScriptType {
  name = 'ABC'

  attributes: IAttributeCollection = {
    test: { type: 'string' }
  }

  initialize() {
    console.log(this.test)
  }
}

Inspiration and credits

https://github.com/whydoidoit/babel-playcanvas-template

https://github.com/snowfrogdev/typescript-playcanvas-template

Thank you!

Releases

No releases published

Packages

No packages published