Skip to content

Support constant refs #16

@marklundin

Description

@marklundin

Similar to #12, it would be useful to specify default values via references

import { Script, SomeEnum } from 'playcanvas';

class MyScript extends Script {
   /**
    * @attribute
    * @type {Vec3}
    */
   up = Vec3.UP

  /**
   * @attribute
   * @type {SomeEnum}
   */
   value = SomeEnum.A
}

Currently this is not supported and the up needs to be initialised ie. (up = new Vec3(0, 1, 0)).

This should be easy to implement for local constant values defined within the program, however for playcanvas values ie VecX.UP etc, the parser only has the playcanvas types and not the actual values ie static readonly UP: Vec2;.

Any solution would need to account for both constant values within the program, and constant values defined with the engine.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions