diff --git a/Runtime/UIParticleProjectSettings.cs b/Runtime/UIParticleProjectSettings.cs new file mode 100644 index 0000000..0ffa28b --- /dev/null +++ b/Runtime/UIParticleProjectSettings.cs @@ -0,0 +1,28 @@ +#pragma warning disable CS0414 +using Coffee.UIParticleInternal; +using UnityEditor; +using UnityEngine; + +namespace Coffee.UIExtensions +{ + public class UIParticleProjectSettings : PreloadedProjectSettings + { + [Header("Setting")] + [SerializeField] + internal bool m_EnableLinearToGamma = true; + + public static bool enableLinearToGamma + { + get => instance.m_EnableLinearToGamma; + set => instance.m_EnableLinearToGamma = value; + } + +#if UNITY_EDITOR + [SettingsProvider] + private static SettingsProvider CreateSettingsProvider() + { + return new PreloadedProjectSettingsProvider("Project/UI/UI Particle"); + } +#endif + } +} diff --git a/Runtime/UIParticleProjectSettings.cs.meta b/Runtime/UIParticleProjectSettings.cs.meta new file mode 100644 index 0000000..22e35af --- /dev/null +++ b/Runtime/UIParticleProjectSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f22a23b9d98e440478697f4adf30e61c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/UIParticleRenderer.cs b/Runtime/UIParticleRenderer.cs index b3252cf..ce1b6ff 100644 --- a/Runtime/UIParticleRenderer.cs +++ b/Runtime/UIParticleRenderer.cs @@ -418,7 +418,7 @@ namespace Coffee.UIExtensions _lastBounds = bounds; // Convert linear color to gamma color. - if (canvas.ShouldGammaToLinearInMesh()) + if (UIParticleProjectSettings.enableLinearToGamma && canvas.ShouldGammaToLinearInMesh()) { workerMesh.LinearToGamma(); }