示例#1
0
        void FixDefaultVolumeProfileAssigned(bool fromAsyncUnused)
        {
            if (!IsHdrpAssetUsedCorrect())
            {
                FixHdrpAssetUsed(fromAsync: false);
            }

            var hdrpAsset = HDRenderPipeline.currentAsset;

            if (hdrpAsset == null)
            {
                return;
            }

            VolumeProfile defaultSettingsVolumeProfileInPackage = hdrpAsset.renderPipelineEditorResources.defaultSettingsVolumeProfile;
            string        defaultSettingsVolumeProfilePath      = "Assets/" + HDProjectSettings.projectSettingsFolderPath + '/' + defaultSettingsVolumeProfileInPackage.name + ".asset";

            //try load one if one already exist
            VolumeProfile defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(defaultSettingsVolumeProfilePath);

            if (defaultSettingsVolumeProfile == null || defaultSettingsVolumeProfile.Equals(null))
            {
                //else create it
                AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(defaultSettingsVolumeProfileInPackage), defaultSettingsVolumeProfilePath);
                defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(defaultSettingsVolumeProfilePath);
            }
            hdrpAsset.defaultVolumeProfile = defaultSettingsVolumeProfile;

            EditorUtility.SetDirty(hdrpAsset);
        }
示例#2
0
            void Draw_VolumeInspector()
            {
                if (m_DefaultVolumeProfile == null || m_DefaultVolumeProfile.Equals(null))
                {
                    m_DefaultVolumeProfile = GetOrCreateDefaultVolumeProfile();
                }

                Editor.CreateCachedEditor(m_DefaultVolumeProfile,
                                          Type.GetType("UnityEditor.Rendering.VolumeProfileEditor"), ref m_Cached);
                m_Cached.OnInspectorGUI();
            }
示例#3
0
        VolumeProfile CreateDefaultVolumeProfileIfNeeded(VolumeProfile defaultSettingsVolumeProfileInPackage)
        {
            string defaultSettingsVolumeProfilePath = "Assets/" + HDProjectSettings.projectSettingsFolderPath + '/' + defaultSettingsVolumeProfileInPackage.name + ".asset";

            if (!AssetDatabase.IsValidFolder("Assets/" + HDProjectSettings.projectSettingsFolderPath))
            {
                AssetDatabase.CreateFolder("Assets", HDProjectSettings.projectSettingsFolderPath);
            }

            //try load one if one already exist
            VolumeProfile defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(defaultSettingsVolumeProfilePath);

            if (defaultSettingsVolumeProfile == null || defaultSettingsVolumeProfile.Equals(null))
            {
                //else create it
                AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(defaultSettingsVolumeProfileInPackage), defaultSettingsVolumeProfilePath);
                defaultSettingsVolumeProfile = AssetDatabase.LoadAssetAtPath <VolumeProfile>(defaultSettingsVolumeProfilePath);
            }

            return(defaultSettingsVolumeProfile);
        }