浏览代码

Add Adaptive Performance.

/adaptive-performance
davidbe 4 年前
当前提交
e73f2844
共有 30 个文件被更改,包括 3098 次插入52 次删除
  1. 337
      Assets/scenes/demo_Island.unity
  2. 10
      Packages/manifest.json
  3. 12
      ProjectSettings/EditorBuildSettings.asset
  4. 2
      ProjectSettings/ProjectSettings.asset
  5. 8
      Assets/Adaptive Performance.meta
  6. 1001
      Assets/Adaptive Performance/AdaptivePerformanceControl.prefab
  7. 7
      Assets/Adaptive Performance/AdaptivePerformanceControl.prefab.meta
  8. 78
      Assets/Adaptive Performance/AdaptivePerformanceGeneralSettings.asset
  9. 8
      Assets/Adaptive Performance/AdaptivePerformanceGeneralSettings.asset.meta
  10. 43
      Assets/Adaptive Performance/AdaptivePerformanceSettings.cs
  11. 11
      Assets/Adaptive Performance/AdaptivePerformanceSettings.cs.meta
  12. 214
      Assets/Adaptive Performance/IndexerVisualisation.cs
  13. 11
      Assets/Adaptive Performance/IndexerVisualisation.cs.meta
  14. 8
      Assets/Adaptive Performance/Provider.meta
  15. 14
      Assets/Adaptive Performance/Provider/Samsung Android Provider Loader.asset
  16. 8
      Assets/Adaptive Performance/Provider/Samsung Android Provider Loader.asset.meta
  17. 14
      Assets/Adaptive Performance/Provider/Simulator Provider Loader.asset
  18. 8
      Assets/Adaptive Performance/Provider/Simulator Provider Loader.asset.meta
  19. 1001
      Assets/Adaptive Performance/ScalerRepresentation.prefab
  20. 7
      Assets/Adaptive Performance/ScalerRepresentation.prefab.meta
  21. 68
      Assets/Adaptive Performance/ScalerVisualisation.cs
  22. 11
      Assets/Adaptive Performance/ScalerVisualisation.cs.meta
  23. 8
      Assets/Adaptive Performance/Settings.meta
  24. 124
      Assets/Adaptive Performance/Settings/Samsung Android Provider Settings.asset
  25. 8
      Assets/Adaptive Performance/Settings/Samsung Android Provider Settings.asset.meta
  26. 121
      Assets/Adaptive Performance/Settings/Simulator Provider Settings.asset
  27. 8
      Assets/Adaptive Performance/Settings/Simulator Provider Settings.asset.meta

337
Assets/scenes/demo_Island.unity


m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1039451621
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1039451626}
- component: {fileID: 1039451625}
- component: {fileID: 1039451624}
- component: {fileID: 1039451623}
- component: {fileID: 1039451622}
m_Layer: 0
m_Name: APCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1039451622
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039451621}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b987748c7167541c7be359b052530b17, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1039451623
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039451621}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
--- !u!81 &1039451624
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039451621}
m_Enabled: 1
--- !u!20 &1039451625
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039451621}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 1
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1039451626
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039451621}
m_LocalRotation: {x: 0.037584357, y: -0.96146387, z: 0.21315138, w: 0.16953209}
m_LocalPosition: {x: -20, y: 14, z: 50}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 25, y: -160, z: 0}
--- !u!1 &1095320327
GameObject:
m_ObjectHideFlags: 3

m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!84 &1150881939
RenderTexture:
--- !u!1001 &1244571676
PrefabInstance:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WaterDepthMap
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1024
m_Height: 1024
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 2
m_ColorFormat: 142
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1482000076034898512, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_MainCams
value:
objectReference: {fileID: 7003470174224757411}
- target: {fileID: 1482000076034898512, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_APCam
value:
objectReference: {fileID: 1039451625}
- target: {fileID: 4356518906837635794, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5830266116653240365, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5830266116653240365, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_RootOrder
value: 8
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276633, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7615951050005276637, guid: b6feb9f89ea6d0c4e8593d8457d87e19,
type: 3}
propertyPath: m_Name
value: AdaptivePerformanceControl
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b6feb9f89ea6d0c4e8593d8457d87e19, type: 3}
--- !u!1 &1405642608
GameObject:
m_ObjectHideFlags: 1

- target: {fileID: 1478924042743889166, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.037609365
value: -0.03760934
objectReference: {fileID: 0}
- target: {fileID: 1478924042743889166, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}

- target: {fileID: 1478924042743889166, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}
propertyPath: m_LocalRotation.z
value: -0.2132932
value: -0.21329314
value: -0.16952659
value: -0.1695265
value: -20.54939
value: -20.549393
value: 49.590775
value: 49.59078
objectReference: {fileID: 0}
- target: {fileID: 3924426380732521610, guid: e70416e3bc35d4004a9981d0ac102ba5,
type: 3}

- target: {fileID: 7003470173341666312, guid: 530da10d6c4d9442e9e8d5eeb77a25d8,
type: 3}
propertyPath: m_LocalPosition.x
value: -88
value: -20.549393
value: 10
value: 14
value: 5
value: 49.59078
value: 0.011147385
value: -0.03760934
value: 0.9860134
value: 0.96143246
value: -0.073744975
value: -0.21329314
value: 0.14904708
value: -0.1695265
objectReference: {fileID: 0}
- target: {fileID: 7003470173341666312, guid: 530da10d6c4d9442e9e8d5eeb77a25d8,
type: 3}

- target: {fileID: 7003470173341666315, guid: 530da10d6c4d9442e9e8d5eeb77a25d8,
type: 3}
propertyPath: field of view
value: 50
value: 60
objectReference: {fileID: 0}
- target: {fileID: 8288760422567894841, guid: 530da10d6c4d9442e9e8d5eeb77a25d8,
type: 3}

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 530da10d6c4d9442e9e8d5eeb77a25d8, type: 3}
--- !u!20 &7003470174224757411 stripped
Camera:
m_CorrespondingSourceObject: {fileID: 7003470173341666315, guid: 530da10d6c4d9442e9e8d5eeb77a25d8,
type: 3}
m_PrefabInstance: {fileID: 7003470174224757410}
m_PrefabAsset: {fileID: 0}

10
Packages/manifest.json


{
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.adaptiveperformance": "2.0.2",
"com.unity.adaptiveperformance.samsung.android": "2.0.2",
"com.unity.device-simulator": "2.2.3-preview",
"com.unity.ide.rider": "2.0.5",
"com.unity.ide.visualstudio": "2.0.1",
"com.unity.ide.vscode": "1.2.1",

"com.unity.render-pipelines.universal": "9.0.0-preview.35",
"com.unity.mobile.android-logcat": "1.1.1",
"com.unity.render-pipelines.core": "file:../../Graphics/com.unity.render-pipelines.core",
"com.unity.render-pipelines.universal": "file:../../Graphics/com.unity.render-pipelines.universal",
"com.unity.shadergraph": "file:../../Graphics/com.unity.shadergraph",
"com.unity.textmeshpro": "3.0.0-preview.14",
"com.unity.textmeshpro": "2.1.1",
"com.unity.timeline": "1.3.4",
"com.unity.ugui": "1.0.0",
"net.peeweek.gameplay-ingredients": "https://github.com/peeweek/net.peeweek.gameplay-ingredients.git#2019.3.0",

12
ProjectSettings/EditorBuildSettings.asset


m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
- enabled: 0
- enabled: 1
- enabled: 0
- enabled: 0
- enabled: 1
com.unity.adaptiveperformance.loader_settings: {fileID: 11400000, guid: 1c2179ef1208a9445a3ee7a025ea1b97,
type: 2}
com.unity.adaptiveperformance.samsung.android.provider_settings: {fileID: 11400000,
guid: dc4d2e4f2e30a02479bc950a42d5466e, type: 2}
com.unity.adaptiveperformance.simulator.provider_settings: {fileID: 11400000,
guid: 555f33cd0c2c87349b0a7607aaad30e0, type: 2}
com.unity.addressableassets: {fileID: 11400000, guid: 3f119a19757f84dac85ee298b9dd65d3,
type: 2}

2
ProjectSettings/ProjectSettings.asset


- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 11400000, guid: dc4d2e4f2e30a02479bc950a42d5466e, type: 2}
- {fileID: -7138420414816539310, guid: 1c2179ef1208a9445a3ee7a025ea1b97, type: 2}
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

8
Assets/Adaptive Performance.meta


fileFormatVersion: 2
guid: 4d8b003d43c86d24881bf59e745dd988
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Assets/Adaptive Performance/AdaptivePerformanceControl.prefab
文件差异内容过多而无法显示
查看文件

7
Assets/Adaptive Performance/AdaptivePerformanceControl.prefab.meta


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

78
Assets/Adaptive Performance/AdaptivePerformanceGeneralSettings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-7138420414816539310
MonoBehaviour:
m_ObjectHideFlags: 2
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: 179fc3111e144bc4688dca4038b3265d, type: 3}
m_Name: Android Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: -4633301848213375430}
m_InitManagerOnStart: 1
--- !u!114 &-4633301848213375430
MonoBehaviour:
m_ObjectHideFlags: 2
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: 536372c49e1ca914d822849d36de938c, type: 3}
m_Name: Android Providers
m_EditorClassIdentifier:
m_AutomaticLoading: 0
m_AutomaticRunning: 0
m_Loaders:
- {fileID: 11400000, guid: 08737b640782b9f488b3a2148b89ba83, type: 2}
--- !u!114 &-3271325679297140068
MonoBehaviour:
m_ObjectHideFlags: 2
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: 536372c49e1ca914d822849d36de938c, type: 3}
m_Name: Standalone Providers
m_EditorClassIdentifier:
m_AutomaticLoading: 0
m_AutomaticRunning: 0
m_Loaders:
- {fileID: 11400000, guid: 06abf77028b8f20438d3f95bca3e24bf, type: 2}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
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: cb0ece14d1f711a4fb9325ca819dee95, type: 3}
m_Name: AdaptivePerformanceGeneralSettings
m_EditorClassIdentifier:
Keys: 0700000001000000
Values:
- {fileID: -7138420414816539310}
- {fileID: 6349174755898872584}
--- !u!114 &6349174755898872584
MonoBehaviour:
m_ObjectHideFlags: 2
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: 179fc3111e144bc4688dca4038b3265d, type: 3}
m_Name: Standalone Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: -3271325679297140068}
m_InitManagerOnStart: 1

8
Assets/Adaptive Performance/AdaptivePerformanceGeneralSettings.asset.meta


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

43
Assets/Adaptive Performance/AdaptivePerformanceSettings.cs


using UnityEngine;
using UnityEngine.AdaptivePerformance;
public class AdaptivePerformanceSettings : MonoBehaviour
{
public bool AdaptiveBatching = false;
public bool AdaptiveFramerate = false;
public bool AdaptiveLOD = false;
public bool AdaptiveLut = false;
public bool AdaptiveMSAA = false;
public bool AdaptiveResolution = false;
public bool AdaptiveShadowCascades = false;
public bool AdaptiveShadowDistance = false;
public bool AdaptiveShadowmapResolution = false;
public bool AdaptiveShadowQuality = false;
public bool AdaptiveSorting = false;
public bool AdaptiveVRR = false;
private void Awake()
{
if (!AdaptivePerformanceGeneralSettings.Instance || !AdaptivePerformanceGeneralSettings.Instance.Manager || !AdaptivePerformanceGeneralSettings.Instance.Manager.isInitializationComplete)
return;
IAdaptivePerformanceSettings settings = AdaptivePerformanceGeneralSettings.Instance.Manager.activeLoader.GetSettings();
if (settings == null)
return;
settings.scalerSettings.AdaptiveBatching.enabled = AdaptiveBatching;
settings.scalerSettings.AdaptiveFramerate.enabled = AdaptiveFramerate;
settings.scalerSettings.AdaptiveLOD.enabled = AdaptiveLOD;
settings.scalerSettings.AdaptiveLut.enabled = AdaptiveLut;
settings.scalerSettings.AdaptiveMSAA.enabled = AdaptiveMSAA;
settings.scalerSettings.AdaptiveResolution.enabled = AdaptiveResolution;
settings.scalerSettings.AdaptiveShadowCascades.enabled = AdaptiveShadowCascades;
settings.scalerSettings.AdaptiveShadowDistance.enabled = AdaptiveShadowDistance;
settings.scalerSettings.AdaptiveShadowmapResolution.enabled = AdaptiveShadowmapResolution;
settings.scalerSettings.AdaptiveShadowQuality.enabled = AdaptiveShadowQuality;
settings.scalerSettings.AdaptiveSorting.enabled = AdaptiveSorting;
var adaptiveVRR = GameObject.FindObjectOfType<AdaptiveVariableRefreshRate>();
if (adaptiveVRR)
adaptiveVRR.Enabled = AdaptiveVRR;
}
}

11
Assets/Adaptive Performance/AdaptivePerformanceSettings.cs.meta


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

214
Assets/Adaptive Performance/IndexerVisualisation.cs


using UnityEngine;
using UnityEngine.UI;
using UnityEngine.AdaptivePerformance;
using System.Collections.Generic;
public class IndexerVisualisation : MonoBehaviour
{
public Text Timer;
public Text Bottleneck;
public Text PerformanceAction;
public Text ThermalAction;
public Text GpuFrameTime;
public Text CpuFrameTime;
public Transform Content;
public ScalerVisualisation ScalerVisualisationPrefab;
public Camera m_MainCams;
public Camera m_APCam;
List<ScalerVisualisation> m_ScalerVisualisations;
List<AdaptivePerformanceScaler> m_AppliedScalers;
List<AdaptivePerformanceScaler> m_UnappliedScalers;
List<AdaptivePerformanceScaler> m_DisabledScalers;
AdaptivePerformanceIndexer m_Indexer;
private void Start()
{
var ap = Holder.Instance;
if (ap == null || !ap.Active)
{
Debug.Log("[AP Indexer Visualisation] Adaptive Performance not active");
enabled = false;
return;
}
m_Indexer = Holder.Instance.Indexer;
if (m_Indexer == null)
{
Debug.Log("[AP Indexer Visualisation] No indexer available");
enabled = false;
return;
}
m_ScalerVisualisations = new List<ScalerVisualisation>();
m_AppliedScalers = new List<AdaptivePerformanceScaler>();
m_UnappliedScalers = new List<AdaptivePerformanceScaler>();
m_DisabledScalers = new List<AdaptivePerformanceScaler>();
}
private void Update()
{
if (!enabled)
return;
Apply();
}
public void SwitchCamera()
{
if(!m_APCam.enabled)
{
m_MainCams.enabled = false;
m_APCam.enabled = true;
}
else
{
m_MainCams.enabled = true;
m_APCam.enabled = false;
}
}
public bool AdaptiveBatching = false;
public bool AdaptiveFramerate = false;
public bool AdaptiveLOD = false;
public bool AdaptiveLut = false;
public bool AdaptiveMSAA = false;
public bool AdaptiveResolution = false;
public bool AdaptiveShadowCascades = false;
public bool AdaptiveShadowDistance = false;
public bool AdaptiveShadowmapResolution = false;
public bool AdaptiveShadowQuality = false;
public bool AdaptiveSorting = false;
public bool AdaptiveVRR = false;
public int m_activeScalerIndex = 0;
public void NextScaler()
{
if (!AdaptivePerformanceGeneralSettings.Instance || !AdaptivePerformanceGeneralSettings.Instance.Manager || !AdaptivePerformanceGeneralSettings.Instance.Manager.isInitializationComplete)
return;
IAdaptivePerformanceSettings settings = AdaptivePerformanceGeneralSettings.Instance.Manager.activeLoader.GetSettings();
if (settings == null)
return;
AdaptiveBatching = false;
AdaptiveFramerate = false;
AdaptiveLOD = false;
AdaptiveLut = false;
AdaptiveMSAA = false;
AdaptiveResolution = false;
AdaptiveShadowCascades = false;
AdaptiveShadowDistance = false;
AdaptiveShadowmapResolution = false;
AdaptiveShadowQuality = false;
AdaptiveSorting = false;
AdaptiveVRR = false;
switch(m_activeScalerIndex)
{
case 0: AdaptiveBatching = true; break;
case 1: AdaptiveFramerate = true; break;
case 2: AdaptiveLOD = true; break;
case 3: AdaptiveLut = true; break;
case 4: AdaptiveMSAA = true; break;
case 5: AdaptiveResolution = true; break;
case 6: AdaptiveShadowCascades = true; break;
case 7: AdaptiveShadowDistance = true; break;
case 8: AdaptiveShadowmapResolution = true; break;
case 9: AdaptiveShadowQuality = true; break;
case 10: AdaptiveSorting = true; break;
case 11: AdaptiveVRR = true; break;
}
m_activeScalerIndex++;
if (m_activeScalerIndex >= 12)
m_activeScalerIndex = 0;
settings.scalerSettings.AdaptiveBatching.enabled = AdaptiveBatching;
settings.scalerSettings.AdaptiveFramerate.enabled = AdaptiveFramerate;
settings.scalerSettings.AdaptiveLOD.enabled = AdaptiveLOD;
settings.scalerSettings.AdaptiveLut.enabled = AdaptiveLut;
settings.scalerSettings.AdaptiveMSAA.enabled = AdaptiveMSAA;
settings.scalerSettings.AdaptiveResolution.enabled = AdaptiveResolution;
settings.scalerSettings.AdaptiveShadowCascades.enabled = AdaptiveShadowCascades;
settings.scalerSettings.AdaptiveShadowDistance.enabled = AdaptiveShadowDistance;
settings.scalerSettings.AdaptiveShadowmapResolution.enabled = AdaptiveShadowmapResolution;
settings.scalerSettings.AdaptiveShadowQuality.enabled = AdaptiveShadowQuality;
settings.scalerSettings.AdaptiveSorting.enabled = AdaptiveSorting;
var adaptiveVRR = GameObject.FindObjectOfType<AdaptiveVariableRefreshRate>();
if (adaptiveVRR)
adaptiveVRR.Enabled = AdaptiveVRR;
}
private void Apply()
{
Debug.Assert(Timer);
Debug.Assert(Bottleneck);
Debug.Assert(PerformanceAction);
Debug.Assert(ThermalAction);
Debug.Assert(GpuFrameTime);
Debug.Assert(CpuFrameTime);
Debug.Assert(Content);
Debug.Assert(ScalerVisualisationPrefab);
Timer.text = $" Timer: <b>{Mathf.RoundToInt(m_Indexer.TimeUntilNextAction)}</b>";
Bottleneck.text =
$" Bottleneck: <b>{Holder.Instance.PerformanceStatus.PerformanceMetrics.PerformanceBottleneck}</b>";
var perfAction = m_Indexer.PerformanceAction;
if (perfAction != StateAction.Decrease && perfAction != StateAction.FastDecrease)
PerformanceAction.text = $" Perf action: <color=lime>{perfAction}</color>";
else
PerformanceAction.text = $" Perf action: <color=red>{perfAction}</color>";
var tempAction = m_Indexer.ThermalAction;
if (tempAction != StateAction.Decrease && tempAction != StateAction.FastDecrease)
ThermalAction.text = $" Thermal action: <color=lime>{tempAction}</color>";
else
ThermalAction.text = $" Thermal action: <color=red>{tempAction}</color>";
GpuFrameTime.text =
$" GPU frame time: {Holder.Instance.PerformanceStatus.FrameTiming.AverageGpuFrameTime:0.####}s";
CpuFrameTime.text =
$" CPU frame time: {Holder.Instance.PerformanceStatus.FrameTiming.AverageCpuFrameTime:0.####}s";
m_Indexer.GetAppliedScalers(ref m_AppliedScalers);
foreach (var scaler in m_AppliedScalers)
CreateScalerVisualisation(scaler);
m_Indexer.GetUnappliedScalers(ref m_UnappliedScalers);
foreach (var scaler in m_UnappliedScalers)
CreateScalerVisualisation(scaler);
m_Indexer.GetDisabledScalers(ref m_DisabledScalers);
foreach (var scaler in m_DisabledScalers)
CreateScalerVisualisation(scaler);
}
private void CreateScalerVisualisation(AdaptivePerformanceScaler scaler)
{
var scalerVisualisation = ContainsScaler(scaler);
if (scalerVisualisation == null)
{
scalerVisualisation = Instantiate(ScalerVisualisationPrefab, Content);
scalerVisualisation.Scaler = scaler;
m_ScalerVisualisations.Add(scalerVisualisation);
}
if (scaler.Enabled)
scalerVisualisation.gameObject.SetActive(true);
else
scalerVisualisation.gameObject.SetActive(false);
}
private ScalerVisualisation ContainsScaler(AdaptivePerformanceScaler scaler)
{
foreach (var current in m_ScalerVisualisations)
{
if (current.Scaler == scaler)
return current;
}
return null;
}
}

11
Assets/Adaptive Performance/IndexerVisualisation.cs.meta


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

8
Assets/Adaptive Performance/Provider.meta


fileFormatVersion: 2
guid: 998d7474c94c66743a6f8afbc9146fe6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
Assets/Adaptive Performance/Provider/Samsung Android Provider Loader.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
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: 12368ffd90e3c4ac4889486ab7b2aa78, type: 3}
m_Name: Samsung Android Provider Loader
m_EditorClassIdentifier:

8
Assets/Adaptive Performance/Provider/Samsung Android Provider Loader.asset.meta


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

14
Assets/Adaptive Performance/Provider/Simulator Provider Loader.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
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: 921854900f2214d7ab9b1e95d17dbb2b, type: 3}
m_Name: Simulator Provider Loader
m_EditorClassIdentifier:

8
Assets/Adaptive Performance/Provider/Simulator Provider Loader.asset.meta


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

1001
Assets/Adaptive Performance/ScalerRepresentation.prefab
文件差异内容过多而无法显示
查看文件

7
Assets/Adaptive Performance/ScalerRepresentation.prefab.meta


fileFormatVersion: 2
guid: 1825aaaa8bf978d45b861791fec73bd3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

68
Assets/Adaptive Performance/ScalerVisualisation.cs


using UnityEngine;
using UnityEngine.UI;
using UnityEngine.AdaptivePerformance;
public class ScalerVisualisation : MonoBehaviour
{
public Text Name;
public Text Value;
public Text Status;
public Slider Level;
public Toggle Override;
public Toggle EnabledToggle;
public AdaptivePerformanceScaler Scaler;
public void SetOverride()
{
if (Scaler == null)
return;
Scaler.OverrideLevel = Override.isOn ? Scaler.CurrentLevel : -1;
Level.interactable = Override.isOn;
}
public void SetEnabled()
{
if (Scaler == null)
return;
Scaler.Enabled = EnabledToggle.isOn;
}
public void SetLevel(float value)
{
if (Scaler == null)
return;
var level = (int)(value * Scaler.MaxLevel);
if (Scaler.OverrideLevel != -1)
Scaler.OverrideLevel = level;
Level.value = (float)level / Scaler.MaxLevel;
Value.text = $"{Level.value}";
}
private void Start()
{
if (Scaler == null)
return;
Name.text = Scaler.Name;
Override.isOn = Scaler.OverrideLevel != -1;
EnabledToggle.isOn = Scaler.Enabled;
Level.value = (float)Scaler.CurrentLevel / Scaler.MaxLevel;
}
private void Update()
{
if (Scaler == null)
return;
Level.interactable = Scaler.OverrideLevel != -1;
if (Scaler.OverrideLevel == -1)
Level.value = (float)Scaler.CurrentLevel / Scaler.MaxLevel;
if (Scaler.Enabled)
Status.text = $"<color=lime>Enabled</color>";
else
Status.text = $"<color=red>Disabled</color>";
}
}

11
Assets/Adaptive Performance/ScalerVisualisation.cs.meta


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

8
Assets/Adaptive Performance/Settings.meta


fileFormatVersion: 2
guid: d04e70a7b46083c4480fdccfb31df745
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

124
Assets/Adaptive Performance/Settings/Samsung Android Provider Settings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
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: 02a364304553d4fe797810bd5c88f9d8, type: 3}
m_Name: Samsung Android Provider Settings
m_EditorClassIdentifier:
m_Logging: 1
m_AutomaticPerformanceModeEnabled: 1
m_StatsLoggingFrequencyInFrames: 50
m_IndexerSettings:
m_Active: 1
m_ThermalActionDelay: 10
m_PerformanceActionDelay: 4
m_ScalerSettings:
m_AdaptiveFramerate:
m_Name: Adaptive Framerate
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 2
m_Target: 7
m_MaxLevel: 45
m_MinBound: 15
m_MaxBound: 60
m_AdaptiveResolution:
m_Name: Adaptive Resolution
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 0
m_Target: 6
m_MaxLevel: 9
m_MinBound: 0.5
m_MaxBound: 1
m_AdaptiveBatching:
m_Name: Adaptive Batching
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveLOD:
m_Name: Adaptive LOD
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveLut:
m_Name: Adaptive Lut
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 1
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveMSAA:
m_Name: Adaptive MSAA
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 6
m_MaxLevel: 2
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowCascades:
m_Name: Adaptive Shadow Cascade
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 2
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowDistance:
m_Name: Adaptive Shadow Distance
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowmapResolution:
m_Name: Adaptive Shadowmap Resolution
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowQuality:
m_Name: Adaptive Shadow Quality
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 2
m_Target: 3
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveSorting:
m_Name: Adaptive Sorting
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: -1
m_MaxBound: -1
m_SamsungProviderLogging: 0
m_HighSpeedVRR: 0
m_AutomaticVRR: 1

8
Assets/Adaptive Performance/Settings/Samsung Android Provider Settings.asset.meta


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

121
Assets/Adaptive Performance/Settings/Simulator Provider Settings.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
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: b592865877cb54284a5d1d88aec9cfbb, type: 3}
m_Name: Simulator Provider Settings
m_EditorClassIdentifier:
m_Logging: 1
m_AutomaticPerformanceModeEnabled: 1
m_StatsLoggingFrequencyInFrames: 50
m_IndexerSettings:
m_Active: 1
m_ThermalActionDelay: 10
m_PerformanceActionDelay: 4
m_ScalerSettings:
m_AdaptiveFramerate:
m_Name: Adaptive Framerate
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 2
m_Target: 7
m_MaxLevel: 45
m_MinBound: 15
m_MaxBound: 60
m_AdaptiveResolution:
m_Name: Adaptive Resolution
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 0
m_Target: 6
m_MaxLevel: 9
m_MinBound: 0.5
m_MaxBound: 1
m_AdaptiveBatching:
m_Name: Adaptive Batching
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveLOD:
m_Name: Adaptive LOD
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveLut:
m_Name: Adaptive Lut
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 1
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveMSAA:
m_Name: Adaptive MSAA
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 6
m_MaxLevel: 2
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowCascades:
m_Name: Adaptive Shadow Cascade
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 2
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowDistance:
m_Name: Adaptive Shadow Distance
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowmapResolution:
m_Name: Adaptive Shadowmap Resolution
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveShadowQuality:
m_Name: Adaptive Shadow Quality
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 2
m_Target: 3
m_MaxLevel: 3
m_MinBound: -1
m_MaxBound: -1
m_AdaptiveSorting:
m_Name: Adaptive Sorting
m_Enabled: 0
m_Scale: -1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: -1
m_MaxBound: -1

8
Assets/Adaptive Performance/Settings/Simulator Provider Settings.asset.meta


fileFormatVersion: 2
guid: 555f33cd0c2c87349b0a7607aaad30e0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存