Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug Type or namespace Universal does not exist in the namespace UnityEngine.Experimental.Rendering

Discussion in '2D' started by Pasix, Jun 9, 2021.

Thread Status:
Not open for further replies.
  1. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7
    Hello,

    I've tried to install the Universal RP 10.4.0 on my Unity 2020.3.5f1 project, but for whatever reason it refuses to recognize the Light2D element from the UnityEngine.Experimental.Rendering.Universal namespace. Reason is stated because it can't find the Universal namespace.

    I've followed the understated guide;
    https://docs.unity3d.com/Packages/c...ersal@10.2/manual/InstallURPIntoAProject.html

    Other steps I took;
    Edit - RenderPipeline -> all upgrade possibilities
    Edit -> Project settings -> Quality -. Set rendering to the UniversalRenderPipelineAsset
    Edit -> Project settings -> Graphics - Set scriptable render pipeline settings to UniversalRenderPipelineAsset
    UniversalRenderPipeLineAsset -> Renderer List -> Set 2D Renderer Data
    Restarted Unity

    I'm completely clueless and can't seem to find anything on the internet resembling my issue.
    Does anyone have a clue?
     
  2. TheNightglow

    TheNightglow

    Joined:
    Oct 1, 2018
    Posts:
    201
    I have a script where I made a flickering 2D light and this works for me in Unityv2019.3.5f1 with URPv7.1.8
    Code (CSharp):
    1. using UnityEngine.Experimental.Rendering.Universal;
    2.  
    3. public class FlickeringLight : MonoBehaviour
    4. {
    5.     public Light2D light;
    6.     //[...]
    7. }
    Maybe they changed under what namespace Light2D is between v7.1.8 and 10.4.0? Like it might no longer be an experimental feature

    if you just have the Light2D reference written without trying the using on UnityEngine.Experimental.Rendering.Universal, what does visual studio suggest for trouble shooting? (as in hover or right click on Light2D)
    maybe visual studio is already able to tell you which using directive you need
     
  3. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7

    The weirdest thing is that Visual Studio also suggests using UnityEngine.Experimental.Rendering.Universal and also seems to recognize the package, but as soon as I go back to Unity it first errors on the namespace Universal, followed by erroring on the type Light2D. The other option it gives is UnityEngine.Experimental.Rendering.LWRP, but it also instantly states being deprecated.
     
  4. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7
    Code (CSharp):
    1. using UnityEngine.Experimental.Rendering.Universal;
    2.  
    3. public class DayAndNightCycle : MonoBehaviour
    4. {
    5.         private Light2D light;
    6. }
    Errors from the get-go.
     
  5. TheNightglow

    TheNightglow

    Joined:
    Oct 1, 2018
    Posts:
    201
    its really weird that it doesnt find the namespace at all...
    I wonder, does it find
    using UnityEngine.Rendering.Universal;

    the 2DLight shouldnt be in that namespace but I wonder if it doesnt find any of the URP namespaces or just some
     
  6. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7
    It doesn't find UnityEngine.Rendering.Universal either. Curious.
     
  7. TheNightglow

    TheNightglow

    Joined:
    Oct 1, 2018
    Posts:
    201
    maybe try to remove the URP from the package manager and add it back again afterwards
     
  8. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7
    Doesn't solve it either, i'm afraid.
     
  9. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7
    Anyone has a clue? I'm looking to implement a feature on a deadline that suffers from this
     
  10. TheNightglow

    TheNightglow

    Joined:
    Oct 1, 2018
    Posts:
    201
    I wonder... because you also mentioned it giving you the option of UnityEngine.Experimental.Rendering.LWRP...

    Do you have LWRP and URP packages installed at the same time? I had that problem a bit ago, where I upgraded an old project that used LWRP to a newer Unity Version resulting in some packages being doubled, like LWRP and URP.
    It did not cause namespace not to be found, but it resulted in some other errors being spammed in the console, untill I removed the duplicate packages from the package manager.
    So if you have LWRP in the package manager aswell, uninstall that, its just the old name for the URP...

    Beyond that I honestly have no idea what the problem could be
     
  11. Pasix

    Pasix

    Joined:
    Jan 5, 2018
    Posts:
    7
    That might be possible, although I can't find it in the package manager. Is there any other place I can find installed packages?
     
    Stephen1701 likes this.
  12. Stephen1701

    Stephen1701

    Joined:
    Mar 29, 2016
    Posts:
    132
    Hello, was this ever fixed? I've got this problem now.
    Although I don't know when it happened. I've opened a project from months ago, installed the new Input manager and it gives me this error. Although it may have happened before and I didn't notice, because it doesn't show up as an error in the console.
     
  13. Stephen1701

    Stephen1701

    Joined:
    Mar 29, 2016
    Posts:
    132
    Hi, I've somehow managed to 'fix' this. Just go to your Solution Explorer in Visual Studio and expand the list of references. Scroll down to the very bottom. I had a few references which has yellow warning marks, as soon as I saw them the marks went away, and it worked again, very strange. Hope this helps.

    upload_2021-8-15_16-26-39.png
     
  14. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    723
    I had this issue as well, the weird thing is if I added the namespace and just simply ignored the warnings, it works fine lol, the errors still show up. I fixed it by reimporting all assets. The above solution probably works just as well.
     
    Stephen1701 likes this.
  15. veltsu12

    veltsu12

    Joined:
    Feb 22, 2020
    Posts:
    1
    I fixed this error by recreating my .csproj files from the preferences and it added the URP references.
     
    ReZero-Rem likes this.
  16. Bakakami

    Bakakami

    Joined:
    Sep 13, 2017
    Posts:
    5
    Using URP version 12.1.2, tried removing "experimental" from reference in script, so just:
    using UnityEngine.Rendering.Universal;
    and it works!, at least for version I'm using, can create vars in code of type light2d :)
     
  17. cacoaraya

    cacoaraya

    Joined:
    Jun 26, 2022
    Posts:
    1
    it works thanks!
     
  18. vavilov9823

    vavilov9823

    Joined:
    Apr 11, 2021
    Posts:
    5
    I had the same problem with Cinemachine. Reimport all scripts helped me
     

    Attached Files:

  19. Blue_Flow

    Blue_Flow

    Joined:
    Feb 8, 2021
    Posts:
    1
    I had the same problem with the Light2D, other solutions could not help me (Unity 2021.3.0f1). Finally solved it by adding "Unity.RenderPipelines.Universal.Runtime" to my assembly definition. Then it let me add the "using UnityEngine.Rendering.Universal" for some reason.
     
  20. Gibbonfiend

    Gibbonfiend

    Joined:
    Jul 23, 2015
    Posts:
    7
    Thanks - this worked for me.
     
  21. Cosmobionics

    Cosmobionics

    Joined:
    Dec 9, 2017
    Posts:
    1
    Use namespace before class name like FunkyCode.Light2D instead of Light2D. And use .GetComponent<FunkyCode.Light2D>();
     
  22. LateNighterDK

    LateNighterDK

    Joined:
    Oct 9, 2018
    Posts:
    4
    Thanks Blue_Flow.

    Just had this annoying problem as well when trying to access the UniversalAdditionalCameraData.
    Doing as you suggested made it accept the using statement (using UnityEngine.Rendering.Universal;)
     
  23. Ukutura

    Ukutura

    Joined:
    Jan 16, 2022
    Posts:
    10
    Blue_Flow's suggestion worked for me. Thank you Blue_Flow!
     
Thread Status:
Not open for further replies.