development-guide

UI Button events

October 28, 2022
development-guide

To make a button in your UI, create a Button UI element with the following properties: value: A string with the text to display on the button. onMouseDown: A callback function that runs every time the user pushes the pointer button on the entity. uiTransform: Positioning properties of the UI element. The following example shows how to create a clickable UI button. ui.tsx file: import { Button } from '@dcl/sdk/react-ecs' export const uiMenu = () => ( <Button value="Click me" uiTransform={{ width: 100, height: 100 }} onMouseDown={() => { console. ...

UI Positioning

October 28, 2022
development-guide

For all kinds of UI content, use the uiTransform component to set the size, position, and other properties related to the entity’s alignment. The uiTransform component works in the screen’s 2d space very much like the Transform component works in the the scene’s 3D space. ui.tsx file: import { UiEntity, ReactEcs } from '@dcl/sdk/react-ecs' import { Color4 } from '@dcl/sdk/math' export const uiMenu = () => ( <UiEntity uiTransform={{ width: '200px', height: '100px', justifyContent: 'center', alignItems: 'center', }} uiBackground={{ color: Color4. ...

UI Text

October 28, 2022
development-guide

Add text to your UI by creating a Label entity. A Label entity has the following fields that can be configured: value: The string to display fontSize: The size of the text, as a number. NOTE: The fontSize is not affected by the size of its entity or parent entities. color: The color of the text, as a Color4 . font: The font to use, taking a value from the Font enum. ...

Troubleshooting

June 29, 2022
development-guide

❗Warning: This is a legacy page covering functionality with the old SDK version 6. See the latest version of this topic here . Issues when running preview # Issue: Can’t run any scene preview, error message says mentions Permissions denied or EACCES # Your operating system doesn’t allow you edit permissions on the folder where you want to run the project. When running the scene, some dependencies need to be installed, but it’s forbidden. ...

Troubleshooting

June 29, 2022
development-guide

Issues when running preview # Issue: Can’t run any scene preview, error message says mentions Permissions denied or EACCES # Your operating system doesn’t allow you edit permissions on the folder where you want to run the project. When running the scene, some dependencies need to be installed, but it’s forbidden. You need to configure the folder’s permissions to allow your Windows/Mac/Linux user account to edit files in them. ...

Create a library

February 8, 2022
development-guide

Libraries are a great way to share solutions to common problems. Complex challenges can be approached once, the solutions encapsulated into a library, and whenever they come up you just need to write one line of code. By sharing libraries with the community, we can make the productivity of all creators grow exponentially. Currently, these libraries in the Examples page are available for all to use. We encourage you to create and share your own as well. ...

Workspaces

February 8, 2022
development-guide

Run multiple Decentraland projects in preview by grouping these into a workspace. Run multiple adjacent scenes to see how they fit, or also run multiple smart wearables together to see how they interact with each other and with different scenes. Running multiple projects in a workspace provides a much more complete testing alternative, to ensure different content works well together. A workspace is a debugging feature, it doesn’t affect the experience in the published scene. ...

Modifier areas

September 24, 2020
development-guide

❗Warning: This is a legacy page covering functionality with the old SDK version 6. See the latest version of this topic here . Avatar Modifiers # Avatars behave and look consistently throughout Decentraland as they walk across scenes. However, you can add an AvatarModifierArea to a region of your scene to affect how player avatars behave when they enter that area. ❗Warning Please limit the amount of AvatarModifierAreas you use in your scene to just a couple. ...

Game objects

February 28, 2018
development-guide

As your scene becomes more complicated, it’s useful to put some of the logic into separate game object files. By doing this, you can keep the main code for the scene clean and simple to read, while encapsulating reusable parts that control several entities in the scene. A Game Object holds all the properties and methods for a type of entity you might find in your scene, for example a door or a button or a monster. ...

System based events

February 14, 2018
development-guide

If your scene has multiple similar entities that are all activated using the same logic, you can write a single system to iterates over all of them and describe that behavior only once. This is also the most performant and more data oriented approach. You can also use a system to detect global input events , so that the scene reacts whenever a key is pressed, without consideration for where the player’s cursor is aiming. ...