Question: How do I install URP in Unity?

Answer

Installing the Universal Render Pipeline (URP) in Unity is a straightforward process that enhances your project with optimized graphics for various platforms. Here's how to install and set up URP:

  1. Open Your Project: Start by opening the Unity project you want to upgrade to URP.

  2. Install URP via Package Manager:

    • Go to Window > Package Manager.
    • Select the Unity Registry from the Packages dropdown.
    • Find Universal RP in the package list.
    • Click the Install button.
  3. Create a URP Asset:

    • In the Project window, right-click and select Create > Rendering > Universal Render Pipeline > Pipeline Asset (Forward Renderer).
    • This creates a Scriptable Render Pipeline (SRP) asset and a Renderer asset.
  4. Assign the URP Asset:

    • Now, go to Edit > Project Settings > Graphics.
    • Drag the newly created URP asset to the Scriptable Render Pipeline Settings slot.
  5. Upgrade Project Materials to URP:

    • After assigning the URP asset, a popup may appear suggesting to upgrade materials. If it does not, you can manually upgrade them.
    • To manually upgrade, go to Edit > Render Pipeline > Universal Render Pipeline > Upgrade Project Materials to UniversalRP Materials.
  6. Review and Fix Any Issues:

    • Some custom shaders might need to be updated to work with URP.
    • Check lighting and other graphical settings as they may appear differently under URP.

Sample Code: Creating URP Asset via Script

If you are automating setup or tooling, you may want to create the URP asset via script. Here’s an example of how to do that:

using UnityEngine; using UnityEditor; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; public class CreateURPAsset { [MenuItem("Assets/Create/URP Asset")] static void CreateURPAssets() { // Create the Universal Render Pipeline asset var urpAsset = UniversalRenderPipelineAsset.Create(); // Optionally configure the asset settings here // Save the created asset to your Assets folder AssetDatabase.CreateAsset(urpAsset, "Assets/URPAsset.asset"); GraphicsSettings.renderPipelineAsset = urpAsset; GraphicsSettings.defaultRenderPipeline = urpAsset; } }

Remember to tweak your settings after installation to optimize for your project's needs and platform-specific requirements. The Universal Render Pipeline offers a balance between beautiful graphics and performance across a wide range of hardware.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book
Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.