Jump to content

GeNa always thinks HDRP is active in a project with both URP and HDRP


Eternic
 Share

Go to solution Solved by Manny,

Recommended Posts

I've just started using GeNa Pro so I might be missing something here, but in my project that has both the URP and HDRP packages, whenever I add a Road Spline it is assigning the HDRP shader even though URP is currently being used.

When the project is using URP if I call GeNa.Core.GeNaUtility.GetActivePipeline() it returns HighDefinition and if I replace all calls to that in the accessible code with my own alternative it still doesn't fix the Road Spline's shader issue. I expect it's doing it rendering pipeline check in DLLs.

 

This is the code I'm using to return the correct currently used rendering pipeline which checks the name to work around missing types if one or both of the SRP packages isn't in the project:

if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline)
{
	if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline.GetType().ToString().Contains("HighDefinition"))
	{
		return GeNa.Core.Constants.RenderPipeline.HighDefinition;
	}
	else
	{
		return GeNa.Core.Constants.RenderPipeline.Universal;
	}
}
return GeNa.Core.Constants.RenderPipeline.BuiltIn;
Link to comment
Share on other sites

11 hours ago, Eternic said:

I've just started using GeNa Pro so I might be missing something here, but in my project that has both the URP and HDRP packages, whenever I add a Road Spline it is assigning the HDRP shader even though URP is currently being used.

When the project is using URP if I call GeNa.Core.GeNaUtility.GetActivePipeline() it returns HighDefinition and if I replace all calls to that in the accessible code with my own alternative it still doesn't fix the Road Spline's shader issue. I expect it's doing it rendering pipeline check in DLLs.

 

This is the code I'm using to return the correct currently used rendering pipeline which checks the name to work around missing types if one or both of the SRP packages isn't in the project:

if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline)
{
	if (UnityEngine.Rendering.GraphicsSettings.currentRenderPipeline.GetType().ToString().Contains("HighDefinition"))
	{
		return GeNa.Core.Constants.RenderPipeline.HighDefinition;
	}
	else
	{
		return GeNa.Core.Constants.RenderPipeline.Universal;
	}
}
return GeNa.Core.Constants.RenderPipeline.BuiltIn;

Hi there @Eternic,

Could I ask why you are using multiple pipeline packages in the same project? To my knowledge, Unity actually recommends not doing this.

Link to comment
Share on other sites

There's definitely a lot of hurdles and extra work involved in having both URP and HDRP in one project, but it is viable. There are some shipped games like Road 96 (which Unity has highlighted as an example of the possibility of using URP and HDRP in some talks) that use a URP build for Switch and HDRP for PC and other consoles and there are others that have done or are doing the same. I believe Lego Builder's Journey might do the same with it's Switch and mobile versions but I'm not sure about that.

 

I'm not yet sure about the viability of having URP and HDRP used in a single build, I need to do some more testing on that, but usually the idea is maintaining support for both in a project so lower end hardware builds could use URP and higher end HDRP. I've not had any insurmountable issues using and switching between both pipelines except for this GeNa issue.

 

Outside of creating complete product that works with URP and HDRP in the end, just having a simpler project with which to develop content with GeNa targeting URP and HDRP seems like a pretty likely scenario for yourselves and users wanted to create custom Spline Extensions or whatever to share with the community. There's no reason GetActivePipeline() should return the wrong information when it's possible to detect the correct one.

Link to comment
Share on other sites

@Eternic It is not recommended to have both URP and HDRP installed this causes many conflicts in code, shaders and build processes. Since both pipelines do share some of the same code base and core content. I would recommend 2 seperate projects and like Manny said before Unity do recommend that you don't have both installed at the same time.

Link to comment
Share on other sites

  • Solution

Hey @Eternic,

Unity Engineers and Developers have stated in various occasions that it is generally bad practice to have your project contain both pipelines when trying to make builds. The amount of work required to maintain the compatibility between pipeline builds is not feasible and even if you were to get it to work, it wouldn't be guaranteed to work without any issues. 

Inline with Unity's recommendation and the fact that most of our customers do not run multiple concurrent pipelines in the same project, we do not support it. That being said, we'll review the behaviour of the pipeline detection system to see if this can be improved.

However, what I can recommend to you is that you make multiple projects that are made for different pipelines. I.e, MyProject_URP, MyProject_HDRP, MyProject_BuiltIn. You could then configure the build for each project differently depending on pipeline but the scenes, scripts, audio files are still the same between each project. If you set it up this way, it also comes with the benefit that you can achieve things like automated builds, continuous integration and so on.

Link to comment
Share on other sites

Ok, that's fair enough, and as you say, having multiple projects is currently the best way to do it. I think you should still fix the pipeline detection function as going forward Unity will be continuing to improve support for URP and HDRP in the same project and right now switching between them in the editor doesn't have any issues.

This is a quote from a Unity developer 2 weeks ago for example:

Quote

Unity is exploring ways to enable both URP and HDRP in the same project in a future version of Unity. At the moment this isn't easy to manage due to hardware and platform differences. That being said, we've seen developers accomplish this generally by having two separate projects - one for URP and another for HDRP. 

How you convert from one pipeline to another will depend on the actual shaders themselves. If you wrote these shaders yourselves, then you can write a script to converts those from one pipeline to another. If you use Shader Graph, the PBR Node actually works pretty well across both pipelines (same with Unlit, though there's a lot less features). If you are relying on 3rd party assets, then you will need to ask the creator to understand their cross-pipeline support.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...