UnityでPost Processingを使い、Post-process VolumeのAuto Exposureの「ExposureCompensation」の値をスクリプトから変更しようと思ったのですが、その方法がわかりません。 スクリプトからは「ExposureCompensation」の値を、操作できなのかすらも分かっていない状態です。
C#
1//Speed Upの値を変更するために書いたコード 2 public PostProcessVolume volum; 3 4 PostProcessProfile profile; 5 6 AutoExposure autoExposure; 7 8 void Start() 9 { 10 profile = volum.profile; 11 if (profile.TryGetSettings<AutoExposure>(out AutoExposure autoExposure)) { 12 autoExposure.speedUp.value = 5f; 13 } 14 }
Auto Exposureの「Speed Up」の値は上のコードで値を変更することができたので、「ExposureCompensation」も同じように書いたのですが、エラーが発生しました。
(二つともコードの最初に「using UnityEngine.Rendering.PostProcessing;」を書いています。)
C#
1//Exposure Compensationの値を変更するために書いたコード 2 public PostProcessVolume volum; 3 4 PostProcessProfile profile; 5 6 AutoExposure autoExposure; 7 8 void Start() 9 { 10 profile = volum.profile; 11 if (profile.TryGetSettings<AutoExposure>(out AutoExposure autoExposure)) { 12 autoExposure.exposureCompensation.value = 5f; 13 } 14 }
発生したエラー
AutoExposure' does not contain a definition for 'exposureCompensation' and no accessible extension method 'exposureCompensation' accepting a first argument of type 'AutoExposure' could be found (are you missing a using directive or an assembly reference?)

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/04/04 05:17