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
PointerHoverFeedback
component was renamed toPointerEvents
- The
Billboard
component has changed properties. It now only has oneBillboardMode
property, that takes an enum that sets several different modes. getRealmData()
is deprecated. UsegetRealm()
instead.isPreview()
is deprecated.getRealm()
now returns an additionalpreview
boolean property to use instead.getParcel()
is deprecated. UsegetSceneInfo()
instead.- The
albedoColor
in a PBRMaterial
component changed from typeColor3
to typeColor4
, to support transparent colors. - In
package.json
, thescripts
section 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 start
andnpm run build
. Don’t usedcl start
ordcl 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.Vector3
andSchemas.Quaternion
. These are useful for defining custom components that store these common data types. - New
Entity
type has been added, it helps with type checking for operations that expect or return an entity - New
onMouseDown
andonMouseUp
properties for UI pointer events - New
Dropdown
UI element - New
Input
UI element - New
Label
UI element - New
texture
andtextureType
properties inuiBackground
let you set images on a UI element. - New
textureSlices
property lets you perform 9-Slice stretching of UI textures, to preserve proportions on the corners and margins. - Basic materials on the
Material
component have a newdiffuseColor
property to apply a plain color to a shade-less material. - The
PointerLock
component allows you to know if the player currently has the cursor locked