Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Platform dependent compilation

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

  1. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    281
    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:
    66
    Interested in having this info too. Did you find something?
    Thanks
     
  3. kripto289

    kripto289

    Joined:
    Feb 21, 2013
    Posts:
    281
    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:
    66
    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:
    281
    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#"