aboutsummaryrefslogtreecommitdiff
path: root/Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs
diff options
context:
space:
mode:
authorTom Harley2018-09-03 23:34:21 +0100
committerTom Harley2018-09-03 23:36:01 +0100
commit5440734d820606b29a795c46172ade5d7eba8efb (patch)
tree85867f40afb02cfa2a5028b515ed0a195866b7e9 /Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs
downloadpowerless-5440734d820606b29a795c46172ade5d7eba8efb.tar.gz
powerless-5440734d820606b29a795c46172ade5d7eba8efb.zip

Initial commit

Diffstat (limited to 'Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs')
-rw-r--r--Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs b/Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs
new file mode 100644
index 0000000..1156197
--- /dev/null
+++ b/Assets/Cinemachine/PostFX/Editor/PostFXAutoImport.cs
@@ -0,0 +1,35 @@
+
+namespace Cinemachine.PostFX
+{
+ /// <summary>Integrates Cinemachine with PostProcessing V1 stack.</summary>
+ /// Since PostPorcessing V1 does not create a define in Player settings the
+ /// way V2 does, we do it ourselves if we detect the presence of PostProcessing V1
+ class PostFXAutoImport
+ {
+ [UnityEditor.InitializeOnLoad]
+ class EditorInitialize
+ {
+ static EditorInitialize()
+ {
+#if UNITY_POST_PROCESSING_STACK_V2
+ // We have PPv2
+ CinemachinePostProcessing.InitializeModule();
+#else
+ // Check for PostProcessing V1. Define symbol if we have it.
+ if (Cinemachine.Utility.ReflectionHelpers.TypeIsDefined("UnityEngine.PostProcessing.PostProcessingBehaviour"))
+ {
+ if (Cinemachine.Editor.ScriptableObjectUtility.AddDefineForAllBuildTargets("UNITY_POST_PROCESSING_STACK_V1"))
+ {
+ string path = Cinemachine.Editor.ScriptableObjectUtility.CinemachineInstallAssetPath + "/PostFX/CinemachinePostFX.cs";
+ UnityEditor.AssetDatabase.ImportAsset(path, UnityEditor.ImportAssetOptions.ForceUpdate);
+ }
+ }
+ #if UNITY_POST_PROCESSING_STACK_V1
+ // We have PPv1
+ CinemachinePostFX.InitializeModule();
+ #endif
+#endif
+ }
+ }
+ }
+}