Unable to switch Post-Process Layer to PostProcessing LayerMask
Hello all,
II got an issue on PostProcessing Effect : When I try to change Post-Process Layer to the one I'm interesting to (8: Postprocessing) I always got the same result : Mixed...
Crazy thing is if I change this inside the editor everything works perfectly.
I'm using PostPorcessing-Stack V2.3..
See the code & the capture :
PostProcessLayer postLayer = go.AddComponent<PostProcessLayer>();
postLayer.volumeTrigger = go.transform;
postLayer.volumeLayer.value = go.layer;
postLayer.antialiasingMode = PostProcessLayer.Antialiasing.FastApproximateAntialiasing;
postLayer.Init(PPResources);
I finally get it, I have to write it like this :
// Bit shift the index of the layer (8) to get a bit mask
postLayer.volumeLayer.value = 1 << 8;
Answer by acakebread · May 16, 2020 at 11:22 AM
the solution is to use LayerMask.GetMask:
PostProcessLayer postProcessLayer = gameObject.GetComponent(); postProcessLayer.volumeLayer.value = LayerMask.GetMask("PostProcessing");
Your answer
Follow this Question
Related Questions
how to get postprocessing parameters 0 Answers
Color Grading: Some Curves don't affect color shifts made using Linear Trackballs 0 Answers
Change Depth of Field in Unity while Runtime 0 Answers
[HELP] Post Processing Stack v2 + Cinemachine - How to track focus on target like PPSv1? 0 Answers
Global Volume object vs Post Processing Volume component in URP 1 Answer