Accessing HDRP libraries in another C# Script

I am creating a game with a detection ring that changes sizes when you do certain things, similar to in assassin’s creed games.

I am using the HDRP decal projector to project the ring. But I want to edit the projection size during runtime from a C# script. How can I access the HDRP libraries in the script so I can grab the decal projector and its properties through a GetComponent<>() script.

We don’t have proper API documentation yet, but you can easily get the decal projector component and change the size using GetComponent<DecalProjector>().size = new Vector3(X, Y, Z);

I am only using these libraries:
using UnityEngine;
using UnityEngine.AI;

If I type in GetComponent<DecalProjector>()
I get this error

Add using UnityEngine.Rendering.HighDefinition;

Note that you can have a look at the DecalProjector component source code here : https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalProjector.cs

2 Likes

Thanks

Now I just get an error that HighDefinition does not exist in that namespace. I have the HDRP package installed and up to date, as well as all its dependencies.

Which version of Unity, which version of HDRP?

HDRP only comes out of experimental in 2019.3 (HDRP 7.x). Assuming you are using an earlier Unity version, and for example HDRP 6.x, you should use the following instead, but keep in mind that you will need to change it again once you start using versions 7 and higher of HDRP:

UnityEngine.Experimental.Rendering.HDPipeline

You just need to add HDRP package as a dependency to your asmdef file.

4993055--487676--upload_2019-9-23_22-6-14.png

I’m not entirely sure how to reference this Assembly-CSharp though.