Set URP Decal Projector opacity by code?

I’d like to pulse a decal projection in my project but I haven’t found any opacity property (or similar) in UnityEngine.Rendering.Universal.DecalProjector class.

8248281--1079184--upload_2022-7-2_7-58-28.png

Is it possible to set the opacity by code?

I’m using Unity 2021.3.5f1 (Universal RP 12.1.7)

1 Like

I’m sure you’ve reviewed the scripting api documentation for that class, correct? If so, what have you found?

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, especially any errors you see
  • links to documentation you used to cross-check your work (CRITICAL!!!)

You may edit your post above.

The DecalProjector property you need is called fadeFactor :).

7 Likes

I don’t even know what it can be URP Decal Projector xDDDD

Some more information about what I’d like to achieve is to pulse a decal from lets say 0.2 to 0.5 opacity over time.

I’ve checked the documentation:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/manual/renderer-feature-decal.html

After further research I found the component documentation as well:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.1/api/UnityEngine.Rendering.Universal.DecalProjector.html
The component documentation at least mentions to set its transparency.

My expectation was to find the same variable name as shown in the URP Decal Projector component :slight_smile:

Thanks @ Kreshi, that is the solution!
The opacity in the URP Decal Projector component can be set with the Universal.DecalProjector.fadeFactor property.

Problem solved.

6 Likes