浏览代码

Merge branch 'master' into testing/automation

/testing-automation
Andrem 3 年前
当前提交
8b5b3f33
共有 18 个文件被更改,包括 221 次插入357 次删除
  1. 15
      Assets/AddressableAssetsData/AddressableAssetSettings.asset
  2. 10
      Assets/AddressableAssetsData/AssetGroups/Utility.asset
  3. 24
      Assets/Data/UniversalRP/BoatDemoRenderer.asset
  4. 3
      Assets/Shaders/UI/UIPanelFade.shader
  5. 2
      Assets/Scripts/Effects/GlobalVolumeFeature.cs.meta
  6. 67
      Assets/Scripts/Editor/GlobalVolumeFeatureEditor.cs
  7. 11
      Assets/Scripts/Editor/GlobalVolumeFeatureEditor.cs.meta
  8. 103
      Assets/Scripts/Effects/GlobalVolumeFeature.cs
  9. 36
      Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_BundledAssetGroupSchema.asset
  10. 8
      Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_BundledAssetGroupSchema.asset.meta
  11. 16
      Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_ContentUpdateGroupSchema.asset
  12. 8
      Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_ContentUpdateGroupSchema.asset.meta
  13. 8
      Assets/AddressableAssetsData/AssetGroups/VolumeProfiles.asset.meta
  14. 49
      Assets/AddressableAssetsData/AssetGroups/VolumeProfiles.asset
  15. 7
      Assets/Objects/misc/DefaultVolume.prefab.meta
  16. 90
      Assets/Objects/misc/DefaultVolume.prefab
  17. 121
      Assets/Scripts/GameSystem/DefaultVolume.cs
  18. 0
      /Assets/Scripts/Effects/GlobalVolumeFeature.cs.meta

15
Assets/AddressableAssetsData/AddressableAssetSettings.asset


m_Name: AddressableAssetSettings
m_EditorClassIdentifier:
m_DefaultGroup: ae971df5c2b654af9a3670c7d1a6fc27
m_OptimizeCatalogSize: 0
m_BundleLocalCatalog: 0
m_CatalogRequestsTimeout: 0
m_IgnoreUnsupportedFilesInBuild: 0
m_NonRecursiveBuilding: 0
m_maxConcurrentWebRequests: 500
m_ContiguousBundles: 0
m_StripUnityVersionFromBundleBuild: 0
m_DisableVisibleSubAssetRepresentations: 0
m_ShaderBundleNaming: 0
m_ShaderBundleCustomNaming:
m_MonoScriptBundleNaming: 0
m_MonoScriptBundleCustomNaming:
m_ContentStateBuildPath:
m_overridePlayerVersion:
m_GroupAssets:
- {fileID: 11400000, guid: 283cfc36cc7e3476c947ddc708efef12, type: 2}

- {fileID: 11400000, guid: 8092aa13f89a049a185fbb3e2e152534, type: 2}
m_BuildSettings:
m_CompileScriptsInVirtualMode: 0
m_CleanupStreamingAssetsAfterBuilds: 1

10
Assets/AddressableAssetsData/AssetGroups/Utility.asset


m_Address: camera
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: d4548d51034644d21971f134c82b6a9a
m_Address: volume_manager
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 46fc3d082b08c4dacacae72d7016c235, type: 2}
m_SchemaSet:

24
Assets/Data/UniversalRP/BoatDemoRenderer.asset


m_EditorClassIdentifier:
m_RendererFeatures:
- {fileID: 770174969183694509}
m_RendererFeatureMap: ad6e17cd0d36b00a
- {fileID: 1203680893676135655}
m_RendererFeatureMap: ad6e17cd0d36b00ae7a47d3a6555b410
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2}
shaders:

debug: 0
causticShader: {fileID: 4800000, guid: 90939d2e4b62841d29c136c866715501, type: 3}
causticTexture: {fileID: 2800000, guid: f395b7d64f44848c6a3cba1f1173fe90, type: 3}
--- !u!114 &1203680893676135655
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 00cb8048fcc7dfc4c8c686452702bdd2, type: 3}
m_Name: NewGlobalVolumeFeature
m_EditorClassIdentifier:
m_Active: 1
_layerMask:
serializedVersion: 2
m_Bits: 4294967295
_baseProfile: {fileID: 11400000, guid: ad80f6934bc444a93bb29c1f6db70cf3, type: 2}
_qualityProfiles:
- {fileID: 11400000, guid: 200e02ce26d6c422db35ba0777d71a09, type: 2}
- {fileID: 11400000, guid: 4fe8789f8ee054ac49d9f7fe042e0918, type: 2}
- {fileID: 11400000, guid: dbf7710ff9a33440f8390ed8e04dbb77, type: 2}

3
Assets/Shaders/UI/UIPanelFade.shader


Tags
{
"RenderPipeline"="UniversalPipeline"
"RenderType"="Transparent-10"
"Queue"="Overlay"
ZWrite Off
Cull Off
HLSLPROGRAM

2
Assets/Scripts/Effects/GlobalVolumeFeature.cs.meta


fileFormatVersion: 2
guid: 95843df7486904214993a4dd7d1c5828
guid: 00cb8048fcc7dfc4c8c686452702bdd2
MonoImporter:
externalObjects: {}
serializedVersion: 2

67
Assets/Scripts/Editor/GlobalVolumeFeatureEditor.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
[CustomEditor(typeof(GlobalVolumeFeature))]
public class GlobalVolumeFeatureEditor : Editor
{
private GlobalVolumeFeature feature;
private SerializedProperty profileList;
private SerializedProperty baseProfile;
private static class Styles
{
public static GUIStyle frameBox = new GUIStyle(EditorStyles.helpBox);
public static GUIStyle header = new GUIStyle(EditorStyles.boldLabel);
public static GUIContent baseGUI = new GUIContent("Global Base Profile",
"This Profile is always active and should be treated as a default global settings for Volumes.");
}
private void OnEnable()
{
profileList = serializedObject.FindProperty(nameof(feature._qualityProfiles));
baseProfile = serializedObject.FindProperty(nameof(feature._baseProfile));
}
public override void OnInspectorGUI()
{
feature = (GlobalVolumeFeature)target;
EditorGUILayout.PropertyField(baseProfile, Styles.baseGUI);
EditorGUILayout.LabelField("Quality Level Profiles", Styles.header);
var qualityLevelNames = QualitySettings.names;
EditorGUILayout.BeginVertical(Styles.frameBox);
// Draw Quality level entries
for (var i = 0; i < qualityLevelNames.Length; i++)
{
if (i >= feature._qualityProfiles.Count)
{
feature._qualityProfiles.Add(null);
EditorUtility.SetDirty(feature);
serializedObject.Update();
}
EditorGUI.BeginChangeCheck();
var obj = feature._qualityProfiles[i];
feature._qualityProfiles[i] = (VolumeProfile)EditorGUILayout.ObjectField(qualityLevelNames[i], obj, typeof(VolumeProfile), false);
if (EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(feature);
serializedObject.Update();
}
}
EditorGUILayout.EndVertical();
if (qualityLevelNames.Length < feature._qualityProfiles.Count)
{
feature._qualityProfiles.RemoveRange(qualityLevelNames.Length, feature._qualityProfiles.Count - qualityLevelNames.Length);
EditorUtility.SetDirty(feature);
}
}
}

11
Assets/Scripts/Editor/GlobalVolumeFeatureEditor.cs.meta


fileFormatVersion: 2
guid: 234cf3565ca2a49dc860867404243203
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

103
Assets/Scripts/Effects/GlobalVolumeFeature.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
//[DisallowMultipleRendererFeature] // once not internal, this needs to be here
public class GlobalVolumeFeature : ScriptableRendererFeature
{
class GlobalVolumePass : ScriptableRenderPass
{
public VolumeProfile _baseProfile;
public List<VolumeProfile> _qualityProfiles;
public LayerMask _layerMask;
private Volume vol;
private Volume qualityVol;
public static GameObject volumeHolder;
// This method is called before executing the render pass.
// It can be used to configure render targets and their clear state. Also to create temporary render target textures.
// When empty this render pass will render to the active camera render target.
// You should never call CommandBuffer.SetRenderTarget. Instead call <c>ConfigureTarget</c> and <c>ConfigureClear</c>.
// The render pipeline will ensure target setup and clearing happens in a performant manner.
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
{
if(volumeHolder == null)
{
volumeHolder = new GameObject("[DefaultVolume]");
vol = volumeHolder.AddComponent<Volume>();
vol.isGlobal = true;
qualityVol = volumeHolder.AddComponent<Volume>();
qualityVol.isGlobal = true;
volumeHolder.hideFlags = HideFlags.HideAndDontSave;
}
if (vol && _baseProfile)
{
vol.sharedProfile = _baseProfile;
}
if(qualityVol && _qualityProfiles != null)
{
var index = QualitySettings.GetQualityLevel();
if(_qualityProfiles.Count >= index && _qualityProfiles[index] != null)
qualityVol.sharedProfile = _qualityProfiles?[index];
}
}
// Here you can implement the rendering logic.
// Use <c>ScriptableRenderContext</c> to issue drawing commands or execute command buffers
// https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html
// You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline.
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
}
// Cleanup any allocated resources that were created during the execution of this render pass.
public override void OnCameraCleanup(CommandBuffer cmd)
{
}
}
GlobalVolumePass m_ScriptablePass;
public LayerMask _layerMask;
public VolumeProfile _baseProfile;
public List<VolumeProfile> _qualityProfiles = new List<VolumeProfile>();
/// <inheritdoc/>
public override void Create()
{
m_ScriptablePass = new GlobalVolumePass
{
// Configures where the render pass should be injected.
renderPassEvent = RenderPassEvent.AfterRenderingTransparents,
_baseProfile = this._baseProfile,
_layerMask = this._layerMask,
_qualityProfiles = this._qualityProfiles,
};
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
if(GlobalVolumePass.volumeHolder == null)
{
var old = GameObject.Find("[DefaultVolume]");
if (Application.isPlaying)
{
Destroy(old);
}
else
{
DestroyImmediate(old);
}
}
renderer.EnqueuePass(m_ScriptablePass);
}
}

36
Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_BundledAssetGroupSchema.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e5d17a21594effb4e9591490b009e7aa, type: 3}
m_Name: 2bd013e8bb2a14fbc857108db02a8889_BundledAssetGroupSchema
m_EditorClassIdentifier:
m_Group: {fileID: 11400000, guid: 8092aa13f89a049a185fbb3e2e152534, type: 2}
m_Compression: 1
m_IncludeInBuild: 1
m_BundledAssetProviderType:
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider
m_ForceUniqueProvider: 0
m_UseAssetBundleCache: 1
m_UseAssetBundleCrc: 1
m_Timeout: 0
m_ChunkedTransfer: 0
m_RedirectLimit: -1
m_RetryCount: 0
m_BuildPath:
m_Id: a97c2753c313940f3b39c7767c006f00
m_LoadPath:
m_Id: 5baa6669c14d34bcc9d172addd4ffac6
m_BundleMode: 0
m_AssetBundleProviderType:
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
m_ClassName: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider
m_BundleNaming: 0

8
Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_BundledAssetGroupSchema.asset.meta


fileFormatVersion: 2
guid: e16bafac92bd546f7b2411b6c28ab796
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

16
Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_ContentUpdateGroupSchema.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
m_Name: 2bd013e8bb2a14fbc857108db02a8889_ContentUpdateGroupSchema
m_EditorClassIdentifier:
m_Group: {fileID: 11400000, guid: 8092aa13f89a049a185fbb3e2e152534, type: 2}
m_StaticContent: 0

8
Assets/AddressableAssetsData/AssetGroups/Schemas/2bd013e8bb2a14fbc857108db02a8889_ContentUpdateGroupSchema.asset.meta


fileFormatVersion: 2
guid: cd30c925ccb374e08be6afe141774141
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
Assets/AddressableAssetsData/AssetGroups/VolumeProfiles.asset.meta


fileFormatVersion: 2
guid: 8092aa13f89a049a185fbb3e2e152534
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

49
Assets/AddressableAssetsData/AssetGroups/VolumeProfiles.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bbb281ee3bf0b054c82ac2347e9e782c, type: 3}
m_Name: VolumeProfiles
m_EditorClassIdentifier:
m_GroupName: VolumeProfiles
m_Data:
m_SerializedData: []
m_GUID: 2bd013e8bb2a14fbc857108db02a8889
m_SerializeEntries:
- m_GUID: 200e02ce26d6c422db35ba0777d71a09
m_Address: vol_quality_low
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 11400000, guid: 200e02ce26d6c422db35ba0777d71a09, type: 2}
m_TargetAsset: {fileID: 11400000, guid: 200e02ce26d6c422db35ba0777d71a09, type: 2}
- m_GUID: 4fe8789f8ee054ac49d9f7fe042e0918
m_Address: vol_quality_medium
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
- m_GUID: ad80f6934bc444a93bb29c1f6db70cf3
m_Address: vol_quality_base
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 11400000, guid: ad80f6934bc444a93bb29c1f6db70cf3, type: 2}
m_TargetAsset: {fileID: 11400000, guid: ad80f6934bc444a93bb29c1f6db70cf3, type: 2}
- m_GUID: dbf7710ff9a33440f8390ed8e04dbb77
m_Address: vol_quality_high
m_ReadOnly: 0
m_SerializedLabels: []
m_MainAsset: {fileID: 0}
m_TargetAsset: {fileID: 0}
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 46fc3d082b08c4dacacae72d7016c235, type: 2}
m_SchemaSet:
m_Schemas:
- {fileID: 11400000, guid: e16bafac92bd546f7b2411b6c28ab796, type: 2}
- {fileID: 11400000, guid: cd30c925ccb374e08be6afe141774141, type: 2}

7
Assets/Objects/misc/DefaultVolume.prefab.meta


fileFormatVersion: 2
guid: d4548d51034644d21971f134c82b6a9a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

90
Assets/Objects/misc/DefaultVolume.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6171279960522736352
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5039070232460465497}
- component: {fileID: 1523940916265185993}
- component: {fileID: 7861318668517722592}
- component: {fileID: 3109418422114241795}
m_Layer: 0
m_Name: DefaultVolume
m_TagString: volume_manager
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5039070232460465497
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6171279960522736352}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1523940916265185993
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6171279960522736352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 95843df7486904214993a4dd7d1c5828, type: 3}
m_Name:
m_EditorClassIdentifier:
volBaseComponent: {fileID: 7861318668517722592}
volQualityComponent: {fileID: 3109418422114241795}
qualityVolumes:
- m_AssetGUID: 200e02ce26d6c422db35ba0777d71a09
m_SubObjectName:
- m_AssetGUID: 4fe8789f8ee054ac49d9f7fe042e0918
m_SubObjectName:
- m_AssetGUID: dbf7710ff9a33440f8390ed8e04dbb77
m_SubObjectName:
--- !u!114 &7861318668517722592
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6171279960522736352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
m_Name:
m_EditorClassIdentifier:
isGlobal: 1
priority: -50
blendDistance: 0
weight: 1
sharedProfile: {fileID: 11400000, guid: ad80f6934bc444a93bb29c1f6db70cf3, type: 2}
--- !u!114 &3109418422114241795
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6171279960522736352}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
m_Name:
m_EditorClassIdentifier:
isGlobal: 1
priority: 50
blendDistance: 0
weight: 1
sharedProfile: {fileID: 11400000, guid: dbf7710ff9a33440f8390ed8e04dbb77, type: 2}

121
Assets/Scripts/GameSystem/DefaultVolume.cs


using System.Collections;
using BoatAttack;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteAlways]
public class DefaultVolume : MonoBehaviour
{
public static DefaultVolume Instance { get; private set; }
public Volume volBaseComponent;
public Volume volQualityComponent;
public AssetReference[] qualityVolumes;
private static bool _loading;
private void Awake()
{
if (volBaseComponent && volQualityComponent)
{
Init();
}
else
{
Utility.SafeDestroy(gameObject);
}
}
private void Init()
{
#if UNITY_EDITOR
gameObject.hideFlags = HideFlags.HideAndDontSave;
#else
DontDestroyOnLoad(gameObject);
#endif
if (Instance != null && Instance != this)
{
if (Debug.isDebugBuild)
Debug.Log($"Extra Volume Manager cleaned up. GUID:{gameObject.GetInstanceID()}");
StopAllCoroutines();
Utility.SafeDestroy(gameObject);
}
else
{
Instance = this;
gameObject.name = "[DefaultVolume]";
if (Debug.isDebugBuild)
Debug.Log($"Default Volume is {gameObject.GetInstanceID()}");
Utility.QualityLevelChange += UpdateVolume;
UpdateVolume(0, Utility.GetTrueQualityLevel()); // First time set
}
}
private void OnDestroy()
{
StopAllCoroutines();
if (Instance == this)
Instance = null;
Utility.QualityLevelChange -= UpdateVolume;
}
private void UpdateVolume(int level, int realLevel)
{
//Setup Quality Vol if needed
if (qualityVolumes?.Length > realLevel && qualityVolumes[realLevel] != null)
{
StartCoroutine(LoadAndApplyQualityVolume(realLevel));
}
else
{
volQualityComponent.sharedProfile = null;
}
}
private IEnumerator LoadAndApplyQualityVolume(int index)
{
while (_loading) { yield return null; }
_loading = true;
var vol = qualityVolumes[index];
if (!vol.OperationHandle.IsValid() || !vol.OperationHandle.IsDone)
{
qualityVolumes[index].LoadAssetAsync<VolumeProfile>();
}
yield return vol.OperationHandle;
volQualityComponent.sharedProfile = vol.OperationHandle.Result as VolumeProfile;
_loading = false;
if (!Debug.isDebugBuild) yield break;
Debug.Log(message: "Updated volumes:\n" +
$" Base Volume : {(volBaseComponent.sharedProfile ? volBaseComponent.sharedProfile.name : "none")}\n" +
$" Quality Volume : {(volQualityComponent.sharedProfile ? volQualityComponent.sharedProfile.name : "none")}\n" +
"Total Volume Stack is now:\n");
}
#if UNITY_EDITOR
[InitializeOnLoadMethod]
#else
[RuntimeInitializeOnLoadMethod]
#endif
private static void LoadMe()
{
if (!(Resources.FindObjectsOfTypeAll(typeof(DefaultVolume)) is DefaultVolume[] vols)) return;
if (vols.Length != 0 || Instance != null)
{
foreach (var vol in vols)
{
if (vol.gameObject.activeSelf && vol.gameObject.activeInHierarchy) vol.Init();
}
}
else
{
Addressables.InstantiateAsync("volume_manager");
}
}
}

/Assets/Scripts/GameSystem/DefaultVolume.cs.meta → /Assets/Scripts/Effects/GlobalVolumeFeature.cs.meta

正在加载...
取消
保存