How to import Decentraland SkyboxEditor into Unity
We are importing this third-party tool created by the official Decentraland team into our Unity project
Introduction
Being able to preview the final result of the Decentraland scene is crucial for the development and testing process in the project.
Otherwhise, we would need to export the scene and test it to check the visual results at different times in the day and night cycle.
That’s why we are importing this third-party tool created by the official Decentraland team into our Unity project.
To get this tool working, we will start importing a few dependencies like the lighting settings and Universal RP. Then, we will import the tool and make some fixes to get everything working.
Objective
Preview DCL scenes in Unity before the export process.
Import Dependencies: i. Universal Render Pipeline ii. Lighting Settings
Import Skybox Editor Tool from the official DCL repository.
Official DCL GitHub Repository https://github.com/decentraland/unity-renderer.git
Universal RP Package (Unity) https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@11.0/manual/
Import lighting settings
First of all, you will need to drag and drop the Lighting settings from the packaged resources to the assets folder in the project. This resource is called InitialSceneSettings.lighting and contains different parameters and settings.
To start using this lighting configuration go to Window/Rendering/Lighting in the Unity Editor and switch your lighting settings with the new one.
With this simple step, your lighting settings are configured to preview DCL scenes.
Import Universal RP
To import the required URP version (the one used in the official repository), go to the Json file called manifest.json and add this code line inside the dependencies section:
"com.unity.render-pipelines.universal": "10.5.1",
You can find this file at C:\...\UnityProject\Packages\manifest.json
It should look something like this:
Now, you have to import the custom package called dcl-UniversalRenderPipeline.unitypackage into the project. You can find this package in the packaged resources.
The next step is selecting the imported URP in the editor.
Open Edit/ProjectSettings/Graphics in the editor and select the new Render Pipeline.
Once the previous steps are completed, your new Render Pipeline is set and ready to use, but most of your materials will appear broken with a full pink colour.
To fix this, go to Edit/Render Pipeline/Universal RP and click “Upgrade Materials to UniversalRP Materials”.
To fix all the materials, you will need to make a few changes:
Select the original materials from the assets folder instead of using instances.
Create a new material to use as new DefaultMaterial.
Change your script references to target the new Render Pipeline if needed.
That’s all for the Universal RP. If you followed the instructions step by step, your URP is now set and ready to be used with the skybox editor.
Import Skybox Editor tool
It’s time to import the last custom package from our packaged resources: dcl-ProceduralSkybox.unitypackage.
Once imported, you may see a few errors in your console log, but don’t panic, it’s normal and we will fix it right now.
First, you’re going to remove packages in conflict (if u have any of them).
A good example is Version Control or Unity Analytics. Those packages’ assemblies conflict with ours and must be removed or renamed to avoid these warnings, depending on the warning.
The second step is to edit the manifest.json file at C:\...\UnityProject\Packages\manifest.json and add the following lines of code to import a few packages with dependencies that must be installed to get the skybox working:
For the third step, you have to drag and drop the content in the folder “dcl-AssemblyAssets”to your Unity Assets folder. This folder contains all the assembly references and metadata that the Unity custom package is missing from the original DCL project Unity-Renderer.
To end with this process, you may need to fix a few code errors that appears if you are using other third-party plugins like UniGif.
Now, you can go to Window/SkyboxEditor in the Unity Editor to open a new tab, allowing you to control the skybox day and night cycle.
Additionally, you have just installed the ToonShader used by DCL to preview the final appearance of the avatars inside the Unity Editor.
Conclusion
The Skybox is a big time saver for previewing the final result of the project and understand how diferent lighting conditions can affect our materials and models in the day/night cycle without repeatedly exporting the scene until we achieve the desired outcome.
However, this process could be easier if Unity exporting all the files with .asmdef and .asmdef.meta extensions in its custom packages, but it doesn’t do so. That’s why I created the dcl-AssemblyAssets folder with a folder hierarchy that combines with the assets imported in the Skybox package, solving all those dependencies to get the skybox working properly.