Question by 
               Pilistice · Aug 12, 2019 at 03:57 PM · 
                c#scripting problempost processingpost-process-effect  
              
 
              why the effects of the Post Processing stack do not activate through an if-statement
Hello
In this script I try to activate the threshold effect of the unity Post Processing stack when the GameObject "sun" is in a certain rotation. To do this I wrote a Debug.Log to verify the rotation of the object and if the if-statement work properly. However, the Debug.Log works correctly but the Threshold remains inactive.
Would anyone know the cause of this problem?
Here is my code:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Rendering.PostProcessing;
 
 public class postProc : MonoBehaviour
 {
     public float bloomThres;
     private GameObject sun;
     Bloom bloomLayer = null;
 
     void Start()
     {
       sun = GameObject.Find("Sun");
       PostProcessVolume volume = gameObject.GetComponent<PostProcessVolume>();
       volume.profile.TryGetSettings(out bloomLayer);
     }
 
     void Update()
     {
       sunRotationPostProc();
     }
 
     void sunRotationPostProc() 
     {
       if(sun.transform.rotation.eulerAngles.x < 360.0f && sun.transform.rotation.eulerAngles.x > 280.0f )
       {
         Debug.Log(sun.transform.rotation.eulerAngles.x);
         bloomLayer.enabled.value == true;
         bloomLayer.threshold.value = bloomThres;
       }
     }
 }
 
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                