Quantcast
Viewing all articles
Browse latest Browse all 713

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(); 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; } } }

Viewing all articles
Browse latest Browse all 713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>