Migration guide 7.1
Between the Alpha version 7.0.5 and the Beta version 7.1.0 of the @dcl/sdk framework there have been multiple breaking changes. A scene written using 7.0.5 will need some minor adjustments when migrated to 7.1.0 Below are the changes that need to be considered:
- Component ids are now a string, instead of a number. Also when defining a component, the order of parameters has been reversed. Now the ID goes first, then the schema.
// OLD export const PainterComponent = engine.defineComponent( { myField: Schemas.Number }, 1234 ) // NEW export const PainterComponent = engine.defineComponent( 'PainterComponent', { myField: Schemas.Number } ) - UI alignment properties have changed types, they’re no longer enums, instead special string types.
**💡 Tip**: In Visual Studio Code, on each property press _Ctrl + Space bar_ to see a dropdown of suggestions with the allowed values. - The
PointerHoverFeedbackcomponent was renamed toPointerEvents - The
Billboardcomponent has changed properties. It now only has oneBillboardModeproperty, that takes an enum that sets several different modes. getRealmData()is deprecated. UsegetRealm()instead.isPreview()is deprecated.getRealm()now returns an additionalpreviewboolean property to use instead.getParcel()is deprecated. UsegetSceneInfo()instead.- The
albedoColorin a PBRMaterialcomponent changed from typeColor3to typeColor4, to support transparent colors. - In
package.json, thescriptssection must be changed to the following:"scripts": { "start": "sdk-commands start", "build": "sdk-commands build", "upgrade-sdk": "npm install --save-dev @dcl/sdk@latest", "upgrade-sdk:next": "npm install --save-dev @dcl/sdk@next" }, - Loading of texture images from external sources requires adding domain to an allowlist on the scene’s scene.json file.
- When running a preview of an SDK7 scene via the command line, use
npm run startandnpm run build. Don’t usedcl startordcl build. The Decentraland Editor is encouraged as the defacto way to run scene previews. - The orientation of Textures is now flipped on plane and cube primitives. This results in a more intuitive result, as the default orientation of a plane now exhibits an image facing the right way. It is also consistent with how video textures are oriented.
- Fixed bug with rotating platforms, they now move players that are standing on them.
New features #
Additionally, the following new features are now available:
- VideoTexture is now implemented for playing streamed videos
- New Schema types
Schemas.Vector3andSchemas.Quaternion. These are useful for defining custom components that store these common data types. - New
Entitytype has been added, it helps with type checking for operations that expect or return an entity - New
onMouseDownandonMouseUpproperties for UI pointer events - New
DropdownUI element - New
InputUI element - New
LabelUI element - New
textureandtextureTypeproperties inuiBackgroundlet you set images on a UI element. - New
textureSlicesproperty lets you perform 9-Slice stretching of UI textures, to preserve proportions on the corners and margins. - Basic materials on the
Materialcomponent have a newdiffuseColorproperty to apply a plain color to a shade-less material. - The
PointerLockcomponent allows you to know if the player currently has the cursor locked