Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Platform dependent compilation

Discussion in 'Graphics Experimental Previews' started by kripto289, Nov 2, 2018.

  1. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    295
    Hello,
    Is there a way to check which rendering version is being used? Default rednering or LWRP/HDRP?
    I write my own shaders for assetstore and want to do uber shader and script for different renderings.
     
  2. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    77
    Interested in having this info too. Did you find something?
    Thanks
     
  3. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    295
    Yes, I find.

    You can check the name of rendering
    Code (CSharp):
    1. var rpa = GraphicsSettings.renderPipelineAsset;
    2. Debug.Log(rpa.name);
    3. //This would print the name of the used SRP Asset. ie: LWRP-HighQuality, LWRP-LowQuality, LWRP-MediumQuality, HDRenderPipelineAsset
    and then you can use define symbols of unity editor (editor -> settings -> player -> other -> script define symols

    I use it for change my shaders for lwrp/hdrp in runtime.
     

    Attached Files:

    stephero likes this.
  4. stephero

    stephero

    Joined:
    Feb 8, 2016
    Posts:
    77
    Many thanks for the info and for the code snippet. I am not a big fan of comparing asset name strings like this:
    Code (CSharp):
    1. if (rpa.name.ToUpper().Contains("LWR")) return FX_RenderingType.LWRP
    But I don't see any other ways.

    Did you find a way to access the HDRP or LWRP version to know if the user has the version 3.2.0 or 3.3.0 of the package for example? Couldn't find any variables in the SRP API about it, even if it seems like a very basic info to provide.
     
  5. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    295
    You can check the version there
    "unity folder\Packages\manifest.json"
    or using native unity file "packages->lightweight RP->package.json" (but I don't know how to read this file using c#"
     
    stephero likes this.