Engine v1.26.0 has been released. Release notes:
To stay updated on engine development, hit Watch on the repo. Support us by hitting Star too!
Engine v1.26.0 has been released. Release notes:
To stay updated on engine development, hit Watch on the repo. Support us by hitting Star too!
Relly awesome that youâre working on ES6 classes and this is for sure a step in the right direction, but it seems as the implementation is not 100% complete yet?
When forking this project https://playcanvas.com/project/668763/overview/es6-script-tests and trying to attach es6-script to an Entity on the scene it simply not possible.
Also, when selecting the es6-script.js asset and looking in the inspector in the right side of the screen it says âNo Script Objects foundâ.
Maybe itâs pc.registerScript()
that isnât registering the script properly?
EDIT: Created an issue on Github: https://github.com/playcanvas/engine/issues/1934
Love the ES6 support! But presumably using it will kill IE11 support for that game? Would you guys ever consider adding a transpiler such as Babel into the build pipeline?
@davidpox
It doesnât answer your question and itâs not a perfect solution but it might show a way.
Iâm currently trying to use the project linked below as it opens up a few possibilities such as using my own IDE (WebStorm) and using TypeScript.
It transpiles your code with webpack and uploads the transpiled code to your project so the door is pretty much open for you to use whatever feature youâd like.
With the newest update this template is now broken, it doesnt work because of the way it attaches attributes to the script type. I wonder if we could get any kind of rollback for this⌠or at least a way to choose what playcanvas build we can use in editor, this template is my main way of working because of vscode + typescript.
Hi @Alberto_Carbajal. That template has not had a commit in over 2 years so it doesnât appear to be maintained. Itâs written by a third party and is not officially supported by the PlayCanvas team. Iâm sure itâs pretty straightforward to update to work against the latest engine though. Note that there are a lot of PlayCanvas developers who do use Typescript locally and they didnât have too difficult a time moving to 1.26.0.
BTW, it is possible to run your scene from the Editor against an older engine version. Check out this page:
Yeah, I know the template is outdated but I found it was pretty easy to modify and use in combination with the PlayCanvas editor so I just thought I wanted to share it as others might find it helpful as well.
Iâm pretty curious on how others are integrating with TypeScript so if you know of any examples, @will, Iâd be gratefulđ
And just to be clear, the only troubles I had moving to 1.26.0 was actually having the editor recognising scripts using the new (to PlayCanvas) ES6 classes. Besides that 1.26.0 works perfectly well.
EDIT: And thanks for the tip on specifying the engine version, I wasnât aware of thatđ
Yeah, that tip about using earlier versions is actually super-useful. Letâs say, for example, thereâs some regression in the engine that affects you. Itâs easy to determine when it was introduced and it allows you to carry on unhindered while we deploy a fix.
I think we need one or more typescript examples in the engine codebase. I created this issue just now:
Anybody want to take that? @aiab_animech maybe?
Urm, Will, i think you missed my issue I have with the latest build and now the online editor has the similar problem as well. attributes
typehinting is lost on generated class, and for es5 case, this.attributes
is erraneously reflected as a typehint, when in reality it should be undefined .This problem wasnât addressed?
https://github.com/playcanvas/engine/pull/1908#issuecomment-603175894
I have to manually patch the playcanvas.d.ts file to add an actual static
behind readonly attributes, so it doesnât appear as a member instance property but instead reflects the proper typehint for ScriptTypeClass.attributes
⌠Somehow, when using jsdoc to export out the field definition (@static
) keyword gets reflected, but it appears to have no effect on the typehints compared to a full static
declaration.
Regarding Typescript and âthe outdated templateââŚ
Use my updated one that is more fairly recent Introducing updated Playcanvas JS/Typescript Template . I have working recent Typescript template examples for the version of Playcanvas just before this new 1.26.0 update (backward compatible) which should still work despite not using the new 1.26.0 version approach (that now allows extending pc.ScriptType directly), . Looks like on the new roadmap, Iâd have to change the approach to extending pc.ScriptType directly and using a a possibly new @registerScript decorator instead (rather than the current @createScript decorator) . However, i think iâd hold this back until the inherant issues with failure to recognise/parse scripts within online editor is dealt with with regards to extending pc.ScriptType directly. (including the typehinting attributes issue i mentioned above).
Honestly though, i felt this update wasnât really that âperfectâ (and i thought youâd would had tested this for longer). There are already some issues assosiated with the use of Es6 classes as mentioned by the others. However, itâs one of those features i wonât use directly anyway since i also want to support mobile browsers as well, which means Babel or some means of transpiling (like Typescript), is still needed just in case (possible to do for online editor compile?).
At least itâs a first step, but ideally, I would have wished for the ability to extend pc.ScriptType directly without having to remember to use âregisterScriptâ at the bottom. (eg. like how in React, you can extend React.Component directlyâŚ). Unfortunately, given the way Playcanvas works, this might not be possible without the use of decorators to make the process more obvious( declaring it on top so it stands out moreâŚ). But decorators are non-standard browser feature requiring either Babel/Typescript. Also, I would wish to have the ability to locally define typed attributes with full type hinting/type checking support available within Typescript like what i already have in my Babel/Typescript template, (but again, i use decorators for thisâŚ).
It seems @aiab_animech has fixed the static attributes
problem:
I just merged that.
When will there be a new release and what changes can I expect?
We are looking at a new release early next week hopefully