Forum begins after the advertisement:


[Part 5] Issue with lighting

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 5] Issue with lighting

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18783
    Tyler Fruge
    Level 5
    Participant
    Helpful?
    Up
    0
    ::

    ok, so the video says to add something for the asset for lighting, but there are none.

    View post on imgur.com
    #18784
    Terence
    Level 31
    Keymaster
    Helpful?
    Up
    0
    ::

    @Alp how do we add an asset to the Rendering Layers (3D) array in the Universal Render Pipeline asset?

    #18785
    Ser Apustaja
    Level 6
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    To add an asset to the Rendering Layers (3D) array in the Universal Render Pipeline (URP) asset, you will typically follow these steps:

    1. Locate the URP Asset: First, ensure you have your Universal Render Pipeline asset created in your project. You can find it in the Project window.

    2. Select the URP Asset: Click on the URP asset to open its Inspector window.

    3. Modify Rendering Layers:

      • In the Inspector, look for the “Rendering” section. There should be an option for “Rendering Layers.”
      • You will see an array where you can add or remove layers.
    4. Add a Layer:

      • To add a new layer, you can usually click a “+” button to add a new element to the array.
      • Then, select or create the asset you want to add to this layer.
    5. Save Changes: Make sure to save any changes you have made to the URP asset.

    If you are working with code, you may need to modify the URP asset programmatically. Here’s a simple example:

    using UnityEngine;
    using UnityEngine.Rendering.Universal;
    
    public class ModifyRenderingLayers : MonoBehaviour
    {
        public UniversalRenderPipelineAsset urpAsset;
    
        void Start()
        {
            if (urpAsset != null)
            {
                // Create a new layer
                LayerMask newLayer = LayerMask.GetMask("NewLayerName");
    
                // Add the new layer to the Rendering Layers array
                int layerCount = urpAsset.renderingLayers.Length;
                System.Array.Resize(ref urpAsset.renderingLayers, layerCount + 1);
                urpAsset.renderingLayers[layerCount] = newLayer;
    
                // Save changes
                UnityEditor.EditorUtility.SetDirty(urpAsset);
                UnityEditor.AssetDatabase.SaveAssets();
            }
        }
    }

    Make sure to replace "NewLayerName" with the actual name of your layer. Also, this script should be run in the Unity Editor, as it uses UnityEditor namespace methods.

    Always remember to backup your project before making changes to URP settings or assets.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: