diff --git a/content/creator/scenes/getting-started/preview-scene.md b/content/creator/scenes/getting-started/preview-scene.md index 512783ba..00d65a60 100644 --- a/content/creator/scenes/getting-started/preview-scene.md +++ b/content/creator/scenes/getting-started/preview-scene.md @@ -23,18 +23,15 @@ To run a scene preview using the Decentraland Editor: Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/scenes/getting-started/installation-guide.md#the-decentraland-editor" >}}). +1. Open your scene's folder using Visual Studio Code. -1) Open your scene's folder using Visual Studio Code. + > Note: The Visual Studio window must be at the root folder of the scene project. - > Note: The Visual Studio window must be at the root folder of the scene project. +2. Open the Decentraland Editor tab on Visual Studio. Note that the bottom section lists all of your project's currently installed dependencies. -2) Open the Decentraland Editor tab on Visual Studio. Note that the bottom section lists all of your project's currently installed dependencies. +3. Click the **Run Scene** button. -3) Click the **Run Scene** button. - - This opens a new tab in Visual Studio Code, running the Decentraland scene, just like in a web browser tab. - -Optionally click **Open in browser**, over the top margin of the tab to run the preview in a web browser window. + This opens a new browser tab running the Decentraland scene. ## Using the CLI @@ -61,7 +58,7 @@ Any dependencies that are missing are installed and then the CLI opens the scene Every time you make changes to the scene, the preview reloads and updates automatically, so there's no need to run the command again. {{< hint warning >}} -**πŸ“” Note**: Some scenes depend on an external server to store a shared state for all players in the scene. When previewing one of these scenes, you'll likely have to also run the server locally on another port. Check the scene's readme for instructions on how to launch the server as well as the scene. +**πŸ“” Note**: Some scenes depend on an external server to store a shared state for all players in the scene. When previewing one of these scenes, you'll likely have to also run the server locally on another port. Check the scene's readme for instructions on how to launch the server as well as the scene. {{< /hint >}} ### Parameters of the preview command @@ -78,17 +75,15 @@ You can add the following flags to the `dcl start` command to change its behavio - `--desktop-client` Runs the preview in the Decentraland Desktop client {{< hint warning >}} -**πŸ“” Note**: To preview old scenes that were built for older versions of the SDK, you must set the corresponding version of `decentraland-ecs` in your project's `package.json` file. +**πŸ“” Note**: To preview old scenes that were built for older versions of the SDK, you must set the corresponding version of `decentraland-ecs` in your project's `package.json` file. {{< /hint >}} - ## Upload a scene to decentraland Once you're happy with your scene, you can upload it and publish it to Decentraland, see [publishing]({{< ref "/content/creator/scenes/publishing/publishing.md" >}}) ) for instructions on how to do that. You can also upload a preview to a free 3rd party server, [see instructions here]({{< ref "/content/creator/scenes/publishing/deploy-third-party.md" >}}). - ## Preview scene size The scene size shown in the preview is based on the scene's configuration. By default, the scene occupies a single parcel (16 x 16 meters). @@ -110,28 +105,25 @@ If you're building a scene to be uploaded to several adjacent parcels, you can e You can also change the coordinates by running the `dcl coords` command from the command line, this is especially useful on large scenes with many parcels. See [set parcels via the command line]({{< ref "/content/creator/sdk7/projects/scene-metadata.md#set-parcels-via-the-command-line">}}) for more details. {{< hint info >}} -**πŸ’‘ Tip**: While running the preview, the parcel coordinates don't need to match those that your scene will really use, as long as they're adjacent and are arranged into the same shape. You will have to replace these with the actual coordinates later when you [deploy the scene](#upload-a-scene-to-decentraland). +**πŸ’‘ Tip**: While running the preview, the parcel coordinates don't need to match those that your scene will really use, as long as they're adjacent and are arranged into the same shape. You will have to replace these with the actual coordinates later when you [deploy the scene](#upload-a-scene-to-decentraland). {{< /hint >}} ## Run preview in Desktop -To run a preview scene in the Desktop native client, instead of in the web browser: - - -1) Make sure you have downloaded and installed the [Windows](https://decentraland.org/download/) or [Mac](https://github.com/decentraland/explorer-desktop-launcher/releases/latest/download/Decentraland.dmg) desktop client. +To run a preview scene in the Desktop native client, instead of in the web browser: -2) Run the preview with: +1. Make sure you have downloaded and installed the [Windows](https://decentraland.org/download/) or [Mac](https://github.com/decentraland/explorer-desktop-launcher/releases/latest/download/Decentraland.dmg) desktop client. - `dcl start --desktop-client` +2. Run the preview with: -3) Copy the URL provided by the console output under **Desktop Client** and paste in your browser. + `dcl start --desktop-client` - > Note: The Browser might ask you for permission to open an external executable: Decentraland. Select **Open**. +3. Copy the URL provided by the console output under **Desktop Client** and paste in your browser. -4) You'll see the following screen. Check that the URL is correct, then click **Continue** to launch the preview. + > Note: The Browser might ask you for permission to open an external executable: Decentraland. Select **Open**. - ![](/images/media/desktop-preview.png) +4. You'll see the following screen. Check that the URL is correct, then click **Continue** to launch the preview. - If you need to manually add anything to the URL, to change the default way the scene runs, tick the box **Add custom URL parameters** and write those in the dialog below. + ![](/images/media/desktop-preview.png) - \ No newline at end of file + If you need to manually add anything to the URL, to change the default way the scene runs, tick the box **Add custom URL parameters** and write those in the dialog below. diff --git a/content/creator/scenes/publishing/publishing.md b/content/creator/scenes/publishing/publishing.md index d4b092a3..f5b642f5 100644 --- a/content/creator/scenes/publishing/publishing.md +++ b/content/creator/scenes/publishing/publishing.md @@ -24,10 +24,10 @@ Make sure of the following: - You own or have permissions to the necessary amount of adjacent LAND parcels. Otherwise you can purchase LAND in the [Market](https://market.decentraland.org). -- You may also choose to publish your scene to a Decentraland [World]({{< ref "/content/creator/worlds/about.md" >}}), in this case, you must own a NAME which you can mint on the [Builder](https://builder.decentraland.zone/names) and your scene must comply with the World limits. +- You may also choose to publish your scene to a Decentraland [World]({{< ref "/content/creator/worlds/about.md" >}}), in this case, you must own a NAME which you can mint on the [Builder](https://builder.decentraland.zone/names) and your scene must comply with the World limits. {{< hint warning >}} -**πŸ“” Note**: Multi-parcel scenes can only be deployed to adjacent parcels. +**πŸ“” Note**: Multi-parcel scenes can only be deployed to adjacent parcels. {{< /hint >}} ## Check scene data @@ -52,56 +52,53 @@ Open your scene's _scene.json_ file and complete the following data: - **rating**: This is used to classify the content of your scene based on its appropriateness for different age groups (`T` for Teens or `A` for Adults). It helps in filtering content for players. - {{< hint warning >}} -**πŸ“” Note**: See [scene metadata]({{< ref "/content/creator/scenes/projects/scene-metadata.md" >}}) for more details on how to set these parameters. +**πŸ“” Note**: See [scene metadata]({{< ref "/content/creator/scenes/projects/scene-metadata.md" >}}) for more details on how to set these parameters. {{< /hint >}} ## To publish the scene ### Via the Decentraland Editor -Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/scenes/getting-started/installation-guide.md#the-decentraland-editor" >}}). +Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/scenes/getting-started/installation-guide.md#the-decentraland-editor" >}}). {{< hint warning >}} -**πŸ“” Note**: Deployment to Worlds is not yet supported from the Editor. +**πŸ“” Note**: Deployment to Worlds is not yet supported from the Editor. {{< /hint >}} -1) Open your scene's folder using Visual Studio Code. +1. Open your scene's folder using Visual Studio Code. {{< hint warning >}} -**πŸ“” Note**: The Visual Studio window must be at the root folder of the scene project. +**πŸ“” Note**: The Visual Studio window must be at the root folder of the scene project. {{< /hint >}} -2) Open the Editor's menu, by clicking the Decentraland logo on the tabs on the left. Then click **Publish scene**. - - This opens a new tab in Visual Studio, showing what parcels you're deploying to. +2. Open the Editor's menu, by clicking the Decentraland logo on the tabs on the left. Then click **Publish scene**. -3) Approve the transaction + This opens a new tab in Visual Studio, showing what parcels you're deploying to. - - If the LAND tokens you own or have permissions are linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. - - If you need to use Metamask on the browser, click **Open in Browser** to open this same window on a browser tab. Then approve the transaction on the Metamask browser extension. +3. Approve the transaction + - For LAND on a Metamask browser extension, click **Approve**. Then approve the transaction on the Metamask browser extension. + - For LAND linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. ### Via the CLI - 1. Log into your Metamask account with the same public address associated with your parcels in Decentraland. 2. Run `dcl deploy` from the scene's folder. -{{< hint info >}} -**πŸ’‘ Tip**: If there are files in your project folder that you don't want to deploy, list them in the _.dclignore_ file before deploying. -{{< /hint >}} -3. Optionally, you can also use the `--target-content` parameter with a World server URL in order to upload the scene to a World instead of to the Genesis City, for example `dcl deploy --target-content https://worlds-content-server.decentraland.org`. + {{< hint info >}} + **πŸ’‘ Tip**: If there are files in your project folder that you don't want to deploy, list them in the _.dclignore_ file before deploying. + {{< /hint >}} +3. Optionally, you can also use the `--target-content` parameter with a World server URL in order to upload the scene to a World instead of to the Genesis City, for example `dcl deploy --target-content https://worlds-content-server.decentraland.org`. 4. A browser tab will open, showing what parcels you're deploying to. Click **Sign and Deploy**. 5. Metamask opens, notifying you that your signature is requested. Click **Sign** to confirm this action. {{< hint info >}} -**πŸ’‘ Tip**: If you're implementing a continuous integration flow, where changes to your scene are deployed automatically, then you can set the `export DCL_PRIVATE_KEY` environment variable to the private key of an account that has deploy permissions. +**πŸ’‘ Tip**: If you're implementing a continuous integration flow, where changes to your scene are deployed automatically, then you can set the `export DCL_PRIVATE_KEY` environment variable to the private key of an account that has deploy permissions. {{< /hint >}} {{< hint info >}} -**πŸ’‘ Tip**: `dcl deploy` runs a `dcl build`, which checks the scene for type errors more strictly than running `dcl start`. If these errors can't be avoided (eg: they happen in an external library) and they don't impact the scene, you can use `dcl deploy --skip-build` to skip the `dcl build` step and deploy the scene as it is. +**πŸ’‘ Tip**: `dcl deploy` runs a `dcl build`, which checks the scene for type errors more strictly than running `dcl start`. If these errors can't be avoided (eg: they happen in an external library) and they don't impact the scene, you can use `dcl deploy --skip-build` to skip the `dcl build` step and deploy the scene as it is. {{< /hint >}} ## Publish from a hardware wallet @@ -138,58 +135,52 @@ The information on each copy of the server is verifiable, as each scene is signe You can deploy content to the test catalyst server to run full tests with multiple users, the sourrounding scenes, and an environment that is identical to production. The test server is identical to all other catalyst servers, the difference is that the content that is deployed to this server isn't propagated to the others. Content deployed to other servers on the other hand does get propagated to this server, so surrounding scenes should look as they will in production. {{< hint warning >}} -**πŸ“” Note**: To deploy to parcels in the test server, you must have the same permissions required to deploy to those parcels in the main network. +**πŸ“” Note**: To deploy to parcels in the test server, you must have the same permissions required to deploy to those parcels in the main network. {{< /hint >}} -Players are never directed to this server, the only way to access it is to explicitly provide a URL parameter to connect to it. +Players are never directed to this server, the only way to access it is to explicitly provide a URL parameter to connect to it. If you're working in a confidential project that you don't want to unveil until launch, note that the test server is relatively hidden from players, but anyone explicitly using the test server's URL could potentially run into it. - ### Via the Decentraland Editor To deploy a scene to the test server: 1. Open VSCode in a Decentraland scene project. 2. Click on the Decentraland icon on the left sidebar. -4. Click on the three dot menu at the top right of the sidebar, next to the green reload arrow button, select `Publish scene to test server` -5. Approve the transaction - - - If the LAND tokens you own or have permissions are linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. - - If you need to use Metamask on the browser, click **Open in Browser** to open this same window on a browser tab. Then approve the transaction on the Metamask browser extension. +3. Click on the three dot menu at the top right of the sidebar, next to the green reload arrow button, select `Publish scene to test server` +4. Approve the transaction + - For LAND on a Metamask browser account, confirm the deployment. Then approve the transaction on the Metamask browser extension. + - For LAND linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. To enter the content server, add `&CATALYST=peer-testing.decentraland.org` to the Decentraland URL _play.decentraland.org/?&CATALYST=peer-testing.decentraland.org_ - ### Via the CLI To deploy to the test server, run: `dcl deploy --target peer-testing.decentraland.org` - To enter the content server, add `&CATALYST=peer-testing.decentraland.org` to the Decentraland URL _https://play.decentraland.org/?CATALYST=peer-testing.decentraland.org_ - ## Verify deployment success Once you deployed your scene, these changes will take a few minutes to be propagated throughout the various content servers in the network. If you enter Decentraland right after deploying, you might still see the previous version of your content, depending of what realm you enter. -After you sign to authorize the deployment of your scene, the signing dapp will start displaying confirmations that the new version of your content has been propagated throughout all of the servers in the network, +After you sign to authorize the deployment of your scene, the signing dapp will start displaying confirmations that the new version of your content has been propagated throughout all of the servers in the network, You'll see a list of each of the servers that make up Decentraland's content network. For each server, it specifies the timestamp of the last uploaded change on that parcel. Each one of these servers refers to a different realm, you can reference how these server names map to realm names in the [catalyst monitor screen](https://decentraland.github.io/catalyst-monitor/). - You can also obtain this information at any time by running the following command on the command line console: `npx @dcl/opscli pointer-consistency --pointer '0,0'` {{< hint warning >}} -**πŸ“” Note**: Use the coordinates of your scene instead of `0,0`. If your scene has multiple parcels, any one of its parcels will produce the same output. If the coordinates start with a negative number, add a `\` at the start of the coordinates to prevent the `-` character from being misinterpreted by the command line. +**πŸ“” Note**: Use the coordinates of your scene instead of `0,0`. If your scene has multiple parcels, any one of its parcels will produce the same output. If the coordinates start with a negative number, add a `\` at the start of the coordinates to prevent the `-` character from being misinterpreted by the command line. {{< /hint >}} ## Automatic deployments @@ -210,21 +201,20 @@ env: DCL_PRIVATE_KEY: ${{ secrets.DCL_PRIVATE_KEY }} jobs: - deploy: name: Deploy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install npm packages - run: | - npm install - - name: Build scene - run: | - npm run build:ci - - name: Deploy scene - run: | - npm run deploy:prod + - uses: actions/checkout@v2 + - name: Install npm packages + run: | + npm install + - name: Build scene + run: | + npm run build:ci + - name: Deploy scene + run: | + npm run deploy:prod ``` > Important: For this process to run, you must set a wallet's private key as an environment variable in GitHub, this is used to sign the deployment. As always, be very careful with keeping the private keys secure. Do NOT use the private key of the account that actually owns the land tokens, as that would have very big risks. Instead, delegate operator rights to a disposable wallet that owns no valuable tokens. If this private key is ever leaked somehow, you can easily revoke those operator rights from the account and set up a new wallet. diff --git a/content/creator/sdk7/3d-essentials/entity-positioning.md b/content/creator/sdk7/3d-essentials/entity-positioning.md index 98da2937..750e1942 100644 --- a/content/creator/sdk7/3d-essentials/entity-positioning.md +++ b/content/creator/sdk7/3d-essentials/entity-positioning.md @@ -13,7 +13,7 @@ You can set the _position_, _rotation_ and _scale_ of any entity by using the `T ## Editor UI -When dragging entities via the Inspector, in the [Decentraland Editor]({{< ref "/content/creator/scenes/getting-started/installation-guide.md#the-decentraland-editor" >}}), you are changing the values in the entity's Transform implicitly. By changing the position, rotation or scale of an entity, this changes the data in that entity's Transform component. +When dragging entities via the Visual Editor, in the [Decentraland Editor]({{< ref "/content/creator/scenes/getting-started/installation-guide.md#the-decentraland-editor" >}}), you are changing the values in the entity's Transform implicitly. By changing the position, rotation or scale of an entity, this changes the data in that entity's Transform component. ## Code essentials diff --git a/content/creator/sdk7/architecture/entities-components.md b/content/creator/sdk7/architecture/entities-components.md index 957c569f..ce2017dd 100644 --- a/content/creator/sdk7/architecture/entities-components.md +++ b/content/creator/sdk7/architecture/entities-components.md @@ -182,7 +182,7 @@ For example, if a player's click or a [raycast]({{< ref "/content/creator/sdk7/i ## Get an entity by name -When using the Decentraland Editor and adding entities via the drag-and-drop inspector, each entity has a unique name. Use the `engine.getEntityOrNullByName()` function to reference one of these entities from your code. Pass the entity's name as a string, as written on the inspector's UI, in the tree view on the left. +When using the Decentraland Editor and adding entities via the drag-and-drop Visual Editor, each entity has a unique name. Use the `engine.getEntityOrNullByName()` function to reference one of these entities from your code. Pass the entity's name as a string, as written on the Visual Editor's UI, in the tree view on the left. ```ts function main() { @@ -191,7 +191,7 @@ function main() { ``` {{< hint warning >}} -**πŸ“” Note**: Make sure you only use `engine.getEntityOrNullByName()` inside the `main()` function, in functions that run after `main()`, or in a system. If used outside one of those contexts, the entities created in the EditorΒ΄s inspector may not yet be instanced. +**πŸ“” Note**: Make sure you only use `engine.getEntityOrNullByName()` inside the `main()` function, in functions that run after `main()`, or in a system. If used outside one of those contexts, the entities created in the Visual Editor may not yet be instanced. {{< /hint >}} You're free to perform any action on an entity fetched via this method, like add or remove components, modify values of existing components, or remove the entity from the engine. @@ -216,7 +216,7 @@ function main() { } ``` -All the entities added via the inspector have a `Name` component, you can iterate over all of them like this: +All the entities added via the Visual Editor have a `Name` component, you can iterate over all of them like this: ```ts function main() { diff --git a/content/creator/sdk7/debugging/debug-in-preview.md b/content/creator/sdk7/debugging/debug-in-preview.md index 3621d465..15d59050 100644 --- a/content/creator/sdk7/debugging/debug-in-preview.md +++ b/content/creator/sdk7/debugging/debug-in-preview.md @@ -32,7 +32,13 @@ Output messages to console (using `console.log()`). You can then view these mess You can also add `debugger` commands or use the `sources` tab in the developer tools menu to add breakpoints and pause execution while you interact with the scene in real time. -Once you deploy the scene, you won't be able to see the messages printed to console when you visit the scene in-world. If you need to check these messages on the deployed scene, you can turn the scene's console messages back on adding the following parameter to the URL: `DEBUG_SCENE_LOG`. +When in preview, the console doesn't display messages from the engine. These are often not relevant to your scene, but if you need to see them add the following parameter to the URL: + +`&DEBUG_LOGS` + +Once you deploy the scene, you won't be able to see the messages printed to console when you visit the scene in-world. If you need to check these messages on the deployed scene, you can turn the scene's console messages back on adding the following parameter to the URL: + +`DEBUG_SCENE_LOG`. ## Add breakpoints in the Decentraland Editor diff --git a/content/creator/sdk7/debugging/troubleshooting.md b/content/creator/sdk7/debugging/troubleshooting.md index 29b9ebe0..c698691b 100644 --- a/content/creator/sdk7/debugging/troubleshooting.md +++ b/content/creator/sdk7/debugging/troubleshooting.md @@ -42,7 +42,7 @@ Ideally, the loading of the code in your scene should follow a clear sequential To fix these dependencies, you often must resort to calling functions or object constructors passing references to already instanced entities/objects in the function arguments; Instead of hard-coding references to these entities/objects in the function, which may or may not already be instanced. -## Issues when running the Editor Inspector +## Issues when running the Visual Editor ### Issue: The editor never finishes loading the scene, it may say something like "Can't connect to server". diff --git a/content/creator/sdk7/getting-started/SDK-101.md b/content/creator/sdk7/getting-started/SDK-101.md index 5ace15cc..b4857671 100644 --- a/content/creator/sdk7/getting-started/SDK-101.md +++ b/content/creator/sdk7/getting-started/SDK-101.md @@ -33,7 +33,7 @@ Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/s 1. Open a Visual Studio Code window on an _empty folder_. 2. Select the Decentraland tab on Visual Studio's left margin sidebar -3. Click **Create Project** +3. Click **Create Project**, then select **Standard Project** This step may take a couple of minutes. It populates your folder with the default set of files for a basic scene. @@ -66,17 +66,17 @@ At the end of your scene’s `index.ts` file, at the end of the `main()` functio ```ts export function main() { - // initial code + // initial code - let avocado = engine.addEntity() + let avocado = engine.addEntity() - GltfContainer.create(avocado, { - src: 'models/Avocado.glb', - }) + GltfContainer.create(avocado, { + src: 'models/Avocado.glb', + }) - Transform.create(avocado, { - position: Vector3.create(3, 1, 3), - }) + Transform.create(avocado, { + position: Vector3.create(3, 1, 3), + }) } ``` @@ -96,30 +96,28 @@ Note that the cubes in your scene all rotate smoothly, but not the avocado you j To make your avocado spin like the cubes, you can simply give it a `Spinner` component. - ```ts import { Spinner } from './components' export function main() { - // initial code + // initial code - let avocado = engine.addEntity() + let avocado = engine.addEntity() - GltfContainer.create(avocado, { - src: 'models/Avocado.glb', - }) + GltfContainer.create(avocado, { + src: 'models/Avocado.glb', + }) - Transform.create(avocado, { - position: Vector3.create(3, 1, 3), - }) + Transform.create(avocado, { + position: Vector3.create(3, 1, 3), + }) - Spinner.create({speed: 1}) + Spinner.create({ speed: 1 }) } ``` With this extra component, the avocado should now behave like the cubes and slowly spin too. Note that the `speed` property lets you make it rotate faster or slower. - {{< hint warning >}} **πŸ“” Note**: The `Spinner` comopnent only exists in the context of this scene. If you try to add a `Spinner` component in another scene, it won't recognize it, unless you also copy the definition of the component, that you can find in the `components.ts` file. @@ -134,13 +132,13 @@ To make your scene more engaging, make the entities in the scene respond to the ```ts pointerEventsSystem.onPointerDown( - { - entity: avocado, - opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, - }, - function () { - console.log('CLICKED AVOCADO') - } + { + entity: avocado, + opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, + }, + function () { + console.log('CLICKED AVOCADO') + } ) ``` @@ -165,14 +163,14 @@ To make your scene more engaging, make the entities in the scene respond to the ```ts pointerEventsSystem.onPointerDown( - { - entity: avocado, - opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, - }, - function () { - console.log('CLICKED AVOCADO') - engine.removeEntity(avocado) - } + { + entity: avocado, + opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, + }, + function () { + console.log('CLICKED AVOCADO') + engine.removeEntity(avocado) + } ) ``` @@ -202,17 +200,17 @@ Let's make the interaction with the avocado a little more engaging: ```ts utils.tweens.startScaling( - avocado, - Vector3.create(1, 1, 1), - Vector3.create(0.1, 0.1, 0.1), - 2 + avocado, + Vector3.create(1, 1, 1), + Vector3.create(0.1, 0.1, 0.1), + 2 ) ``` The `utils.tweens.startScaling` function requires the following parameters: - `entity`: What entity to work on -- `start`: Starting scale. +- `start`: Starting scale. - `end`: Ending scale. - `duration`: Duration (in seconds) of start to end scaling. @@ -220,24 +218,23 @@ The `utils.tweens.startScaling` function requires the following parameters: **πŸ’‘ Tip**: Your code editor will hint this information to you once you typed `utils.tweens.startScaling(`. {{< /hint >}} - 5. Instead of having the avocado shrink on its own when the scene starts, replace the function called by the pointer events handler, so that it performs the shrinking action instead of removing the entity from the engine. ```ts pointerEventsSystem.onPointerDown( - { - entity: avocado, - opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, - }, - function () { - console.log('CLICKED AVOCADO') - utils.tweens.startScaling( - avocado, - Vector3.create(1, 1, 1), - Vector3.create(0.1, 0.1, 0.1), - 2 - ) - } + { + entity: avocado, + opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, + }, + function () { + console.log('CLICKED AVOCADO') + utils.tweens.startScaling( + avocado, + Vector3.create(1, 1, 1), + Vector3.create(0.1, 0.1, 0.1), + 2 + ) + } ) ``` @@ -248,24 +245,24 @@ The `utils.tweens.startScaling` function requires the following parameters: ```ts pointerEventsSystem.onPointerDown( - { - entity: avocado, - opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, - }, - function () { - console.log('CLICKED AVOCADO') - utils.tweens.startScaling( - avocado, - Vector3.create(1, 1, 1), - Vector3.create(0.1, 0.1, 0.1), - 2, - utils.InterpolationType.EASEOUTEBOUNCE, - () => { - console.log('FINISHED') - engine.removeEntity(avocado) - } - ) - } + { + entity: avocado, + opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' }, + }, + function () { + console.log('CLICKED AVOCADO') + utils.tweens.startScaling( + avocado, + Vector3.create(1, 1, 1), + Vector3.create(0.1, 0.1, 0.1), + 2, + utils.InterpolationType.EASEOUTEBOUNCE, + () => { + console.log('FINISHED') + engine.removeEntity(avocado) + } + ) + } ) ``` @@ -281,6 +278,10 @@ Read [coding-scenes]({{< ref "/content/creator/sdk7/getting-started/coding-scene For examples that are built with SDK7, check out the [Examples page](https://studios.decentraland.org/resources?sdk_version=SDK7) that contains several small scenes, all written with SDK7. +{{< hint info >}} +**πŸ’‘ Tip**: To avoid downloading the entire repo, with dozens of scenes, and just copy one project, see [Scene from example]({{< ref "/content/creator/sdk7/getting-started/scene-from-example.md" >}}). +{{< /hint >}} + See the **Development guide** section for more instructions about adding content to your scene. ## Engage with other developers diff --git a/content/creator/sdk7/getting-started/decentraland-editor.md b/content/creator/sdk7/getting-started/decentraland-editor.md index 5db93e01..cc2ca1b8 100644 --- a/content/creator/sdk7/getting-started/decentraland-editor.md +++ b/content/creator/sdk7/getting-started/decentraland-editor.md @@ -27,8 +27,8 @@ Ultimately the editor will offer many no-code options for placing items, and set - **Publish scenes**: publish your scene to the world. See [Publishing]({{< ref "/content/creator/sdk7/publishing/publishing.md" >}}). - **Manage dependencies**: add, remove, and list the libraries and dependencies that your project is using. See [Manage dependencies]({{< ref "/content/creator/sdk7/libraries/manage-dependencies.md" >}}). - **Preview models**: Open a gltf or .glb model to see an interactive preview. -- **Drag and drop entities visually (Alpha)**: Use the **Inspector** view to drag and drop entities into place, and configure some of their components via UI. -- **Reference entities added visually in your code**: Entities that are added using the inspector can then be referenced in your code to add interactivity to them. See [Get an entity by name]({{< ref "/content/creator/sdk7/architecture/entities-components.md#get-an-entity-by-name" >}}). +- **Drag and drop entities visually (Alpha)**: Use the **Visual Editor** view to drag and drop entities into place, and configure some of their components via UI. +- **Reference entities added visually in your code**: Entities that are added using the Visual Editor can then be referenced in your code to add interactivity to them. See [Get an entity by name]({{< ref "/content/creator/sdk7/architecture/entities-components.md#get-an-entity-by-name" >}}). ## Reporting issues diff --git a/content/creator/sdk7/getting-started/preview-scene.md b/content/creator/sdk7/getting-started/preview-scene.md index 5d4a1004..dd80829e 100644 --- a/content/creator/sdk7/getting-started/preview-scene.md +++ b/content/creator/sdk7/getting-started/preview-scene.md @@ -26,9 +26,7 @@ Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/s 3. Click the **Run Scene** button. - This opens a new tab in Visual Studio Code, running the Decentraland scene, just like in a web browser tab. - -Optionally click **Open in browser**, over the top margin of the tab to run the preview in a web browser window. + This opens a browser tab running the Decentraland scene. ## Using the CLI diff --git a/content/creator/sdk7/getting-started/scene-from-example.md b/content/creator/sdk7/getting-started/scene-from-example.md new file mode 100644 index 00000000..62f1f1a1 --- /dev/null +++ b/content/creator/sdk7/getting-started/scene-from-example.md @@ -0,0 +1,26 @@ +--- +date: 2018-02-11 +title: Scene from example +description: Create a new scene from an existing example +categories: + - development-guide +type: Document +url: /creator/development-guide/scene-from-example +weight: 4 +--- + +Create a new Decentraland scene project based on an example to start out with a solid base. You can use this to reuse game mechanics, art assets, or anything that may be included in the parent project. + +1. Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/scenes/getting-started/installation-guide.md#the-decentraland-editor" >}}) + +2. Open a Visual Studio Code window on an _empty folder_. +3. Select the Decentraland tab on Visual Studio's left margin sidebar, and click **Create Project** +4. Select the option **From GitHub Repository**. Then paste a URL to the GitHub repository you want to clone. + +Use examples from the [Example scenes]({{< ref "/content/creator/tutorials/examples.md#deploy-to-the-test-environment">}}) page. Many of these are specially designed to be great starting places for certain kinds of scenes. + +{{< hint info >}} +**πŸ’‘ Tip**: To avoid downloading the entire repo, with dozens of scenes, copy just the URL to a project folder. Right click on the **View Code** link and copy that link address, then paste that into the new project prompt. For example: + +`https://github.com/decentraland/sdk7-goerli-plaza/tree/main/reward-claim` +{{< /hint >}} diff --git a/content/creator/sdk7/libraries/create-libraries.md b/content/creator/sdk7/libraries/create-libraries.md index bfa2c3bf..615ab9e5 100644 --- a/content/creator/sdk7/libraries/create-libraries.md +++ b/content/creator/sdk7/libraries/create-libraries.md @@ -13,7 +13,7 @@ Libraries are a great way to share solutions to common problems. Complex challen Currently, these libraries in the [Examples page](https://studios.decentraland.org/resources?sdk_version=SDK7&resource_type=Library) are available for all to use. We encourage you to create and share your own as well. -By using the CLI and following the steps detailed here, you can avoid most of the complexity that comes with creating a library that is compatible with Decentraland scenes and is easy to share with others. +By following the steps detailed here, you can avoid most of the complexity that comes with creating a library that is compatible with Decentraland scenes and is easy to share with others. ## Create a library @@ -23,19 +23,22 @@ By using the CLI and following the steps detailed here, you can avoid most of th To create your own library and share it via NPM, do the following: -1. In an empty folder, run `npx @dcl/sdk-commands init`, then select the option `Library`. +1. Create a new empty folder, and open a new VS Studio Code window there. + +2. Select the Decentraland tab on Visual Studio's left margin sidebar +3. Click **Create Project**, then select **Library** This will create all of the default files and dependencies for a Decentraland library. -2. Set a unique `name` in `package.json`. This is the name that will be used when publishing to NPM, make sure there isn't some other existing project using that name on npm. Also fill in the description and any tags to help others find your library. +4. Set a unique `name` in `package.json`. This is the name that will be used when publishing to NPM, make sure there isn't some other existing project using that name on npm. Also fill in the description and any tags to help others find your library. -3. Create a new _public_ GitHub repository for your project. +5. Create a new _public_ GitHub repository for your project. The project is configured to use github actions to publish a new version of the package on every push to `main`. In the `package.json` file, make sure that in `repository` you point the `url` field to your repo's URL. That way it's easy to find for users navigating [npmjs.com](https://www.npmjs.com). -4. Get an NPM token: +6. Get an NPM token: 1. Create an account or log in to https://www.npmjs.com/. 2. Go to **Account > Access Tokens > Generate new Token** @@ -43,15 +46,15 @@ To create your own library and share it via NPM, do the following: The success message includes a string for the newly generated token. Copy this string and store it somewhere safe. -5. In your github repository, go to **Settings > Secrets > Actions**, then click **New Repository Secret**. +7. In your github repository, go to **Settings > Secrets > Actions**, then click **New Repository Secret**. Name your secret **NPM_TOKEN**, and paste the string from the NPM token as its value. -6. Push a change (any change) to the main branch of your GitHub repo and the package will be published. +8. Push a change (any change) to the main branch of your GitHub repo and the package will be published. That's it, now the package can be installed by anyone using `npm i `! You can now find your library if you search for it by name in [npmjs.com](https://www.npmjs.com). -7. Flesh out the `/src` folder of your project with all the functionality you want to expose and push changes to GitHub. +9. Flesh out the `/src` folder of your project with all the functionality you want to expose and push changes to GitHub. ## Develop diff --git a/content/creator/sdk7/networking/authoritative-servers.md b/content/creator/sdk7/networking/authoritative-servers.md index d06f6905..449ce766 100644 --- a/content/creator/sdk7/networking/authoritative-servers.md +++ b/content/creator/sdk7/networking/authoritative-servers.md @@ -37,6 +37,10 @@ API + DB: - [Guestbook](https://github.com/decentraland/sdk7-goerli-plaza/tree/main/guest-book-api) - [Validate authenticity](https://github.com/decentraland/sdk7-goerli-plaza/tree/main/validate-player-authenticity) +{{< hint info >}} +**πŸ’‘ Tip**: To avoid downloading the entire repo, with dozens of scenes, and just copy one project, see [Scene from example]({{< ref "/content/creator/sdk7/getting-started/scene-from-example.md" >}}). +{{< /hint >}} + ## Preview scenes with dedicated servers To preview a scene that uses a 3rd party server, you must run both the scene and the server it relies on. The server can be run locally in the same machine as the preview, as an easier way to test it. diff --git a/content/creator/sdk7/projects/scene-metadata.md b/content/creator/sdk7/projects/scene-metadata.md index d182cc4d..744ac80c 100644 --- a/content/creator/sdk7/projects/scene-metadata.md +++ b/content/creator/sdk7/projects/scene-metadata.md @@ -15,7 +15,7 @@ See [Files in a scene]({{< ref "/content/creator/sdk7/projects/scene-files.md" > ## Metadata -To edit a scene's metadata from the Decentraland Editor, open the Inspector, and click the **pencil icon**. +To edit a scene's metadata from a UI, open Visual Editor, and click the **pencil icon**. Scene name @@ -47,10 +47,8 @@ The image on `navmapThumbnail` should be a path to an image file in the project In case you want other developers to be able to reach out to you, you can also add contact information to your scene. - ## Categories - You can add categories to your scene to help players and users explore Decentraland better. These are used in the [Decentraland Places dApp](https://places.decentraland.org) to categorize each place and make it easier for users to find what they're interested in. **Categories** need to be chosen from a pre-defined list of options: diff --git a/content/creator/sdk7/publishing/publishing.md b/content/creator/sdk7/publishing/publishing.md index 73265b3f..5df272a7 100644 --- a/content/creator/sdk7/publishing/publishing.md +++ b/content/creator/sdk7/publishing/publishing.md @@ -20,10 +20,9 @@ Make sure of the following: - You own the necessary amount of adjacent LAND parcels. Otherwise you can purchase LAND in the [Market](https://market.decentraland.org). {{< hint warning >}} -**πŸ“” Note**: Multi-parcel scenes can only be deployed to adjacent parcels. +**πŸ“” Note**: Multi-parcel scenes can only be deployed to adjacent parcels. {{< /hint >}} - ## Check scene data When deploying, the CLI reads information from the _scene.json_ to know where to deploy your scene to. @@ -46,59 +45,53 @@ Open your scene's _scene.json_ file and complete the following data: - **rating**: This is used to classify the content of your scene based on its appropriateness for different age groups (`T` for Teens or `A` for Adults). It helps in filtering content for players. - {{< hint warning >}} -**πŸ“” Note**: See [scene metadata]({{< ref "/content/creator/sdk7/projects/scene-metadata.md" >}}) for more details on how to set these parameters. +**πŸ“” Note**: See [scene metadata]({{< ref "/content/creator/sdk7/projects/scene-metadata.md" >}}) for more details on how to set these parameters. {{< /hint >}} - ## To publish the scene - ### Via the Decentraland Editor Make sure you've [installed the Decentraland editor]({{< ref "/content/creator/sdk7/getting-started/installation-guide.md#the-decentraland-editor" >}}). -1) Open your scene's folder using Visual Studio Code. +1. Open your scene's folder using Visual Studio Code. {{< hint warning >}} -**πŸ“” Note**: The Visual Studio window must be at the root folder of the scene project. +**πŸ“” Note**: The Visual Studio window must be at the root folder of the scene project. {{< /hint >}} +2. Open the Editor's menu, by clicking the Decentraland logo on the tabs on the left. Then click **Publish scene**. -2) Open the Editor's menu, by clicking the Decentraland logo on the tabs on the left. Then click **Publish scene**. - - This opens a new tab in Visual Studio, showing what parcels you're deploying to. + This opens a new tab in Visual Studio, showing what parcels you're deploying to. -3) Approve the transaction +3. Approve the transaction - - If the LAND tokens you own or have permissions are linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. - - If you need to use Metamask on the browser, click **Open in Browser** to open this same window on a browser tab. Then approve the transaction on the Metamask browser extension. +- For LAND on a Metamask browser account, confirm the deployment. Then approve the transaction on the Metamask browser extension. +- For LAND linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. ### Via the CLI 1. Log into your Metamask account with the same public address associated with your parcels in Decentraland. 2. Run `npm run deploy` from the scene's folder. -{{< hint info >}} -**πŸ’‘ Tip**: If there are files in your project folder that you don't want to deploy, list them in the _.dclignore_ file before deploying. -{{< /hint >}} + {{< hint info >}} + **πŸ’‘ Tip**: If there are files in your project folder that you don't want to deploy, list them in the _.dclignore_ file before deploying. + {{< /hint >}} 3. A browser tab will open, showing what parcels you're deploying to. Click **Sign and Deploy**. 4. Metamask opens, notifying you that your signature is requested. Click **Sign** to confirm this action. {{< hint info >}} -**πŸ’‘ Tip**: If you're implementing a continuous integration flow, where changes to your scene are deployed automatically, then you can set the `export DCL_PRIVATE_KEY` environment variable to the private key of an account that has deploy permissions. +**πŸ’‘ Tip**: If you're implementing a continuous integration flow, where changes to your scene are deployed automatically, then you can set the `export DCL_PRIVATE_KEY` environment variable to the private key of an account that has deploy permissions. {{< /hint >}} {{< hint info >}} -**πŸ’‘ Tip**: `npm run deploy` runs a `npm run build`, which checks the scene for type errors more strictly than running `npm run start`. If these errors can't be avoided (eg: they happen in an external library) and they don't impact the scene, you can use `npm run deploy --skip-build` to skip the `npm run build` step and deploy the scene as it is. +**πŸ’‘ Tip**: `npm run deploy` runs a `npm run build`, which checks the scene for type errors more strictly than running `npm run start`. If these errors can't be avoided (eg: they happen in an external library) and they don't impact the scene, you can use `npm run deploy --skip-build` to skip the `npm run build` step and deploy the scene as it is. {{< /hint >}} - When publishing to a [Decentraland World]({{< ref "/content/creator/worlds/about.md" >}}) , use the following command instead: `npm run deploy -- --target-content https://worlds-content-server.decentraland.org` - ## Publish from a hardware wallet Instead of storing your LAND tokens in a Metamask account, you may find it more secure to store them in a hardware wallet device, such as a [Ledger](https://www.ledger.com/) or a [Trezor](https://trezor.io/), that's physically plugged in to your computer. @@ -132,12 +125,10 @@ The information on each copy of the server is verifiable, as each scene is signe You can deploy content to the test catalyst server to run full tests with multiple users, the sourrounding scenes, and an environment that is identical to production. The test server is identical to all other catalyst servers, the difference is that the content that is deployed to this server isn't propagated to the others. Content deployed to other servers on the other hand does get propagated to this server, so surrounding scenes should look as they will in production. - {{< hint warning >}} -**πŸ“” Note**: To deploy to parcels in the test server, you must have the same permissions required to deploy to those parcels in the main network. +**πŸ“” Note**: To deploy to parcels in the test server, you must have the same permissions required to deploy to those parcels in the main network. {{< /hint >}} - Players are never directed to this server, the only way to access it is to explicitly provide a URL parameter to connect to it. If you're working in a confidential project that you don't want to unveil until launch, note that the test server is relatively hidden from players, but anyone explicitly using the test server's URL could potentially run into it. @@ -151,9 +142,8 @@ To deploy a scene to the test server: 3. Click on the three dot menu at the top right of the sidebar, next to the green reload arrow button, select `Publish scene to test server` 4. Approve the transaction - - If the LAND tokens you own or have permissions are linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. - - If you need to use Metamask on the browser, click **Open in Browser** to open this same window on a browser tab. Then approve the transaction on the Metamask browser extension. - +- For LAND on a Metamask browser account, confirm the deployment. Then approve the transaction on the Metamask browser extension. +- For LAND linked to a wallet you can use via Wallet Connect, click **Connect wallet**, then scan the QR code with your mobile device and follow the steps on Wallet Connect. To enter the content server, add `&CATALYST=peer-testing.decentraland.org` to the Decentraland URL @@ -161,18 +151,14 @@ _play.decentraland.org/&CATALYST=peer-testing.decentraland.org_ ### Via the CLI - To deploy to the test server, run: `npm run deploy -- --target peer-testing.decentraland.org` - To enter the content server, add `&CATALYST=peer-testing.decentraland.org` to the Decentraland URL _https://play.decentraland.org/?CATALYST=peer-testing.decentraland.org_ - - ## Verify deployment success Once you deployed your scene, these changes will take a few minutes to be propagated throughout the various content servers in the network. If you enter Decentraland right after deploying, you might still see the previous version of your content, depending of what realm you enter. @@ -181,16 +167,14 @@ After you sign to authorize the deployment of your scene, the signing dapp will You'll see a list of each of the servers that make up Decentraland's content network. For each server, it specifies the timestamp of the last uploaded change on that parcel. Each one of these servers refers to a different realm, you can reference how these server names map to realm names in the [catalyst monitor screen](https://decentraland.github.io/catalyst-monitor/). - You can also obtain this information at any time by running the following command on the command line console: `npx @dcl/opscli pointer-consistency --pointer '0,0'` {{< hint warning >}} -**πŸ“” Note**: Use the coordinates of your scene instead of `0,0`. If your scene has multiple parcels, any one of its parcels will produce the same output. If the coordinates start with a negative number, add a `\` at the start of the coordinates to prevent the `-` character from being misinterpreted by the command line. +**πŸ“” Note**: Use the coordinates of your scene instead of `0,0`. If your scene has multiple parcels, any one of its parcels will produce the same output. If the coordinates start with a negative number, add a `\` at the start of the coordinates to prevent the `-` character from being misinterpreted by the command line. {{< /hint >}} - ## Automatic deployments If you regularly make changes to your scene's content and want to implement a streamlined publication pipeline, you can automate the deployment of your scene via a GitHub action. @@ -209,21 +193,20 @@ env: DCL_PRIVATE_KEY: ${{ secrets.DCL_PRIVATE_KEY }} jobs: - deploy: name: Deploy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install npm packages - run: | - npm install - - name: Build scene - run: | - npm run build:ci - - name: Deploy scene - run: | - npm run deploy:prod + - uses: actions/checkout@v2 + - name: Install npm packages + run: | + npm install + - name: Build scene + run: | + npm run build:ci + - name: Deploy scene + run: | + npm run deploy:prod ``` > Important: For this process to run, you must set a wallet's private key as an environment variable in GitHub, this is used to sign the deployment. As always, be very careful with keeping public keys secure. Do NOT use the public key of the account that actually owns the land tokens, as that would have very big risks. Instead, delegate operator rights to a disposable wallet that owns no valuable tokens. If this private key is ever leaked somehow, you can easily revoke those operator rights from the account and set up a new wallet. diff --git a/content/creator/sdk7/releases/alpha-testing-guidelines.md b/content/creator/sdk7/releases/alpha-testing-guidelines.md index 56f53cc7..9765a1ec 100644 --- a/content/creator/sdk7/releases/alpha-testing-guidelines.md +++ b/content/creator/sdk7/releases/alpha-testing-guidelines.md @@ -38,9 +38,12 @@ You can deploy scenes with SDK7 via the **Publish Scene** button on the Editor. You can find more example scenes written with SDK7 here: -- [SDK7 Scene Template](https://github.com/decentraland/sdk7-scene-template) - [Goerli Plaza](https://github.com/decentraland/sdk7-goerli-plaza) +{{< hint info >}} +**πŸ’‘ Tip**: To avoid downloading the entire repo, with dozens of scenes, and just copy one project, see [Scene from example]({{< ref "/content/creator/sdk7/getting-started/scene-from-example.md" >}}). +{{< /hint >}} + ## Reporting issues If you encounter a problem, please see [Report a bug]({{< ref "/content/creator/sdk7/debugging/report-bug.md">}}). diff --git a/content/creator/sdk7/web-editor/combine-with-code.md b/content/creator/sdk7/web-editor/combine-with-code.md index 85f90506..841c8adf 100644 --- a/content/creator/sdk7/web-editor/combine-with-code.md +++ b/content/creator/sdk7/web-editor/combine-with-code.md @@ -9,7 +9,7 @@ url: /creator/editor-plus-code weight: 5 --- -The Decentraland Editor plus custom code is a very powerful combination for creating content. You can use the visual editor to position items intuitively, and then write code that interacts with these items with complete freedom. You can even place a smart item, that has its own default behavior, and write code that reacts to when the item is activated. +The Decentraland Editor plus custom code is a very powerful combination for creating content. You can use the Visual Editor to position items intuitively, and then write code that interacts with these items with complete freedom. You can even place a smart item, that has its own default behavior, and write code that reacts to when the item is activated. For example, you can take advantage of an existing lever smart item, that already comes with its sounds and animations and states, and write code that detects when the lever is pulled to run your own custom logic. @@ -30,11 +30,11 @@ To edit the code in a scene created with the [web editor]({{< ref "/content/crea 2. This will download a _.zip_ file, extract it. 3. Open the extracted folder with Visual Studio Code. The folder must be open at the root of the project. -Once you're done, you can edit the files under the `/src` folder to add behavior with code to your scene. You can also open the **Inspector** to keep editing items visually, just like in the web editor. +Once you're done, you can edit the files under the `/src` folder to add behavior with code to your scene. You can also open the **Visual Editor** to keep editing items visually, just like in the web editor. ## Reference an item -When using the Decentraland Editor and adding entities via the drag-and-drop inspector, each entity has a unique name. Use the `engine.getEntityOrNullByName()` function to reference one of these entities from your code. Pass the entity's name as a string, as written on the inspector's UI, in the tree view on the left. +When using the Decentraland Editor and adding entities via the drag-and-drop Visual Editor, each entity has a unique name. Use the `engine.getEntityOrNullByName()` function to reference one of these entities from your code. Pass the entity's name as a string, as written on the Visual Editor's UI, in the tree view on the left. ```ts function main() { @@ -45,7 +45,7 @@ function main() { {{< hint warning >}} -**πŸ“” Note**: Make sure you only use `engine.getEntityOrNullByName()` inside the `main()` function, in functions that run after `main()`, or in a system. If used outside one of those contexts, the entities created in the EditorΒ΄s inspector may not yet be instanced. +**πŸ“” Note**: Make sure you only use `engine.getEntityOrNullByName()` inside the `main()` function, in functions that run after `main()`, or in a system. If used outside one of those contexts, the entities created in the Visual Editor may not yet be instanced. {{< /hint >}} You're free to perform any action on an entity fetched via this method, like add or remove components, modify values of existing components, or remove the entity from the engine. @@ -70,7 +70,7 @@ function main() { } ``` -All the entities added via the inspector have a `Name` component, you can also iterate over all of them like this: +All the entities added via the Visual Editor have a `Name` component, you can also iterate over all of them like this: ```ts function main() { @@ -150,6 +150,5 @@ function main() { ``` {{< hint info >}} -**πŸ’‘ Tip**: If you're not trying to do something very complicated, instead of writing code you can also create a custom smart item to handle the actions you want to perform. See [Making any item smart]({{< ref "/content/creator/sdk7/web-editor/smart-items.md#making-any-item-smart" >}}) +**πŸ’‘ Tip**: If you're not trying to do something very complicated, instead of writing code you can also create a custom smart item to handle the actions you want to perform. See [Making any item smart]({{< ref "/content/creator/sdk7/web-editor/smart-items.md#making-any-item-smart" >}}) {{< /hint >}} - diff --git a/content/creator/tutorials/examples.md b/content/creator/tutorials/examples.md index bde6ce08..1425964d 100644 --- a/content/creator/tutorials/examples.md +++ b/content/creator/tutorials/examples.md @@ -9,4 +9,8 @@ aliases: [SDK 7 example scenes](https://studios.decentraland.org/resources) +{{< hint info >}} +**πŸ’‘ Tip**: To avoid downloading the entire repo, with dozens of scenes, and just copy one project, see [Scene from example]({{< ref "/content/creator/sdk7/getting-started/scene-from-example.md" >}}). +{{< /hint >}} +