浏览代码

fixed simultaneous loading of volumes from happening

/seans-add-link-xml
André McGrail 4 年前
当前提交
5259355d
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 10
      Assets/Scripts/GameSystem/DefaultVolume.cs

10
Assets/Scripts/GameSystem/DefaultVolume.cs


public Volume volBaseComponent;
public Volume volQualityComponent;
public AssetReference[] qualityVolumes;
private static bool _loading;
private void Awake()
{

{
Instance = this;
gameObject.name = "[DefaultVolume]";
Debug.Log($"Default Volume is {gameObject.GetInstanceID()}");
if (UniversalRenderPipeline.asset.debugLevel != PipelineDebugLevel.Disabled)
Debug.Log($"Default Volume is {gameObject.GetInstanceID()}");
Utility.QualityLevelChange += UpdateVolume;
UpdateVolume(0, Utility.GetTrueQualityLevel()); // First time set
}

private IEnumerator LoadAndApplyQualityVolume(int index)
{
while (_loading) { yield return null; }
_loading = true;
if (!vol.OperationHandle.IsValid() || vol.OperationHandle.Status != AsyncOperationStatus.Succeeded)
if (!vol.OperationHandle.IsValid() || !vol.OperationHandle.IsDone)
_loading = false;
if (UniversalRenderPipeline.asset.debugLevel == PipelineDebugLevel.Disabled) yield break;
if (volBaseComponent.sharedProfile && volQualityComponent.sharedProfile)

#endif
static void LoadMe()
{
Debug.Log("runtime loading");
var vols = Resources.FindObjectsOfTypeAll(typeof(DefaultVolume)) as DefaultVolume[];
if (vols == null) return;

正在加载...
取消
保存