This repository contains the Unity part of decentraland explorer. This component works alongside Kernel to produce an Explorer build.
This repo requires git lfs
to track images and other binary files. https://git-lfs.github.com/ .
So, before anything make sure you have it installed by typing:
git lfs install
git lfs pull
Take this path if you intend to contribute on features without the need of modifying Kernel. This is the recommended path for artists.
- Download and install Unity 2020.3.0f1
- Open the scene named
InitialScene
- Within the scene, select the
DebugConfig
GameObject. - On
DebugConfig
inspector, make sure thatBase url mode
is set toCustom
andBase url custom
is set tohttps://play.decentraland.zone/?
- Run the Initial Scene in the Unity editor
- A browser tab with
explorer
should open automatically and steal your focus, don't close it!. Login with your wallet, go back to Unity and explorer should start running on theGame View
. - As you can see,
DebugConfig
has other special options like the starting position, etc. You are welcome to use them as you see fit, but you'll have to close the tab and restart the scene for them to make effect.
If while trying to compile the Unity project you get an error regarding some libraries that can not be added (for instance Newtonsoft Json.NET or Google Protobuf), please execute the following command in the root folder:
git lfs install
git lfs pull
Then, on the Unity editor, click on Assets > Reimport All
To test against a build made on this repository, you can use a link with this format:
https://play.decentraland.zone/?renderer-branch=<branch-name>
Note that using this approach, the Unity builds will run against kernel master
HEAD.
If you want to test your Unity branch against a specific kernel branch, you'll have to use the renderer
url param like this:
https://play.decentraland.zone/?renderer-branch=<branch-name>&kernel-branch=<kernel-branch-name>
If the CI for both branches succeeds, you can browse to the generated link and test your changes. Bear in mind that any push will kick the CI. There's no need to create a pull request.
Use this approach when working on any features that need both Kernel and Unity modifications, and you need to watch Unity code changes fast without the need of injecting a wasm targeted build in the browser.
When the steps are followed, you will be able to test your changes with just pressing the "Play" button within Unity. This will open a tab running the local Kernel build and Unity will connect to it using websocket.
This is the most useful debugging scenario for advanced feature implementation.
- Make sure you have the proper Unity version up and running
- Make sure you have Kernel repository cloned and set up.
- Make sure you are running kernel through
make watch
command. - Back in unity editor, open the
DebugConfig
component inspector ofInitialScene
- Make sure that the component is setup correctly
- Hit 'Play' button
This approach works when your Unity modifications run well in the wasm targeted unity build, but you don't want to wait for the CI to kick in. This is also useful for remote profiling.
When the steps are followed, you will be able to run the local Unity build by going to localhost:3000
without the need of CI.
- Make sure you have the proper Unity version up and running
- Make sure you have Kernel repository cloned.
- Make sure you are running kernel through
make watch
command in the cloned repo directory. - Make sure you have the explorer website repository cloned.
- Make sure you have the local website up and running by executing
npm run start:linked
in the cloned repo directory. - Produce a Unity wasm targeted build using the Build menu.
- When the build finishes, copy all the files inside the resulting
/build
folder (unity.loader.js
is not necessary as we use a modified loader) and paste them insideexplorer-website/node_modules/@dcl/unity-renderer
. - Run the browser explorer through
localhost:3000
. Now, it should use your local Unity build. - If you need a Unity re-build, you can just replace the files and reload the browser without restarting the
make watch
process nor the website.
For more advanced topics, don't forget to check out our Architecture Decisions Records (ADR) repository.
This repository is protected with a standard Apache 2 license. See the terms and conditions in the LICENSE file.