diff --git a/Basis Server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs b/Basis Server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs index 88b6bee72..c6c8440bf 100644 --- a/Basis Server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs +++ b/Basis Server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs @@ -74,10 +74,8 @@ public static LocalLoadResource FromBasisLoadableConfiguration(BasisLoadableConf - - - - + + false diff --git a/Basis/Assets/AddressableAssetsData/link.xml b/Basis/Assets/AddressableAssetsData/link.xml deleted file mode 100644 index e41553120..000000000 --- a/Basis/Assets/AddressableAssetsData/link.xml +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset index a1d79d859..f1feda271 100644 --- a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset +++ b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Desktop.asset @@ -25,7 +25,7 @@ MonoBehaviour: m_SupportsTerrainHoles: 0 m_SupportsHDR: 0 m_HDRColorBufferPrecision: 0 - m_MSAA: 1 + m_MSAA: 8 m_RenderScale: 1 m_UpscalingFilter: 0 m_FsrOverrideSharpness: 0 diff --git a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset index 8749803b5..4f975af1d 100644 --- a/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset +++ b/Basis/Assets/Basis/Settings/Quality Settiings/Modified - Quest.asset @@ -17,7 +17,7 @@ MonoBehaviour: m_RendererType: 1 m_RendererData: {fileID: 0} m_RendererDataList: - - {fileID: 11400000, guid: c40be3174f62c4acf8c1216858c64956, type: 2} + - {fileID: 11400000, guid: dc6efa2bbf91054468277b399108bb90, type: 2} m_DefaultRendererIndex: 0 m_RequireDepthTexture: 0 m_RequireOpaqueTexture: 0 @@ -25,7 +25,7 @@ MonoBehaviour: m_SupportsTerrainHoles: 0 m_SupportsHDR: 0 m_HDRColorBufferPrecision: 0 - m_MSAA: 4 + m_MSAA: 2 m_RenderScale: 1 m_UpscalingFilter: 0 m_FsrOverrideSharpness: 0 @@ -77,14 +77,14 @@ MonoBehaviour: m_StoreActionsOptimization: 0 m_UseAdaptivePerformance: 1 m_ColorGradingMode: 0 - m_ColorGradingLutSize: 32 + m_ColorGradingLutSize: 16 m_AllowPostProcessAlphaOutput: 0 m_UseFastSRGBLinearConversion: 1 m_SupportDataDrivenLensFlare: 0 m_SupportScreenSpaceLensFlare: 0 m_GPUResidentDrawerMode: 1 m_SmallMeshScreenPercentage: 0 - m_GPUResidentDrawerEnableOcclusionCullingInCameras: 1 + m_GPUResidentDrawerEnableOcclusionCullingInCameras: 0 m_ShadowType: 1 m_LocalShadowsSupported: 0 m_LocalShadowsAtlasResolution: 256 @@ -107,7 +107,7 @@ MonoBehaviour: m_PrefilteringModeDeferredRendering: 0 m_PrefilteringModeScreenSpaceOcclusion: 0 m_PrefilterDebugKeywords: 1 - m_PrefilterWriteRenderingLayers: 0 + m_PrefilterWriteRenderingLayers: 1 m_PrefilterHDROutput: 1 m_PrefilterAlphaOutput: 1 m_PrefilterSSAODepthNormals: 1 diff --git a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/StandardRenderer.asset b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/DesktopRenderer.asset similarity index 99% rename from Basis/Assets/Basis/Settings/Unity Rendering Defaults/StandardRenderer.asset rename to Basis/Assets/Basis/Settings/Unity Rendering Defaults/DesktopRenderer.asset index 6c4be7290..396c3a5ee 100644 --- a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/StandardRenderer.asset +++ b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/DesktopRenderer.asset @@ -53,7 +53,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} - m_Name: StandardRenderer + m_Name: DesktopRenderer m_EditorClassIdentifier: debugShaders: debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, type: 3} diff --git a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/StandardRenderer.asset.meta b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/DesktopRenderer.asset.meta similarity index 100% rename from Basis/Assets/Basis/Settings/Unity Rendering Defaults/StandardRenderer.asset.meta rename to Basis/Assets/Basis/Settings/Unity Rendering Defaults/DesktopRenderer.asset.meta diff --git a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/QuestRenderer.asset b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/QuestRenderer.asset new file mode 100644 index 000000000..5b9ecace0 --- /dev/null +++ b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/QuestRenderer.asset @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4357968347084770853 +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: 980a78cc4df543b29a2663be288cd2f5, type: 3} + m_Name: UniversalBlurFeature + m_EditorClassIdentifier: + m_Active: 1 + k__BackingField: 0 + injectionPoint: 450 + k__BackingField: 0.689 + downsample: 3.44 + iterations: 6 + scale: 1.45 + scaleBlurWith: 2 + scaleReferenceSize: 1080 + shader: {fileID: 4800000, guid: bb11bdc2e8aaf4c80b5315f3778d7ad4, type: 3} +--- !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: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} + m_Name: QuestRenderer + m_EditorClassIdentifier: + debugShaders: + debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, type: 3} + hdrDebugViewPS: {fileID: 4800000, guid: 573620ae32aec764abd4d728906d2587, type: 3} + probeVolumeSamplingDebugComputeShader: {fileID: 7200000, guid: 53626a513ea68ce47b59dc1299fe3959, type: 3} + probeVolumeResources: + probeVolumeDebugShader: {fileID: 4800000, guid: e5c6678ed2aaa91408dd3df699057aae, type: 3} + probeVolumeFragmentationDebugShader: {fileID: 4800000, guid: 03cfc4915c15d504a9ed85ecc404e607, type: 3} + probeVolumeOffsetDebugShader: {fileID: 4800000, guid: 53a11f4ebaebf4049b3638ef78dc9664, type: 3} + probeVolumeSamplingDebugShader: {fileID: 4800000, guid: 8f96cd657dc40064aa21efcc7e50a2e7, type: 3} + probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 57d7c4c16e2765b47a4d2069b311bffe, type: 3} + probeSamplingDebugTexture: {fileID: 2800000, guid: 24ec0e140fb444a44ab96ee80844e18e, type: 3} + probeVolumeBlendStatesCS: {fileID: 0} + m_RendererFeatures: [] + m_RendererFeatureMap: + m_UseNativeRenderPass: 1 + xrSystemData: {fileID: 0} + postProcessData: {fileID: 0} + m_AssetVersion: 2 + m_OpaqueLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_TransparentLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_DefaultStencilState: + overrideStencilState: 0 + stencilReference: 0 + stencilCompareFunction: 8 + passOperation: 2 + failOperation: 0 + zFailOperation: 0 + m_ShadowTransparentReceive: 0 + m_RenderingMode: 2 + m_DepthPrimingMode: 1 + m_CopyDepthMode: 0 + m_DepthAttachmentFormat: 0 + m_DepthTextureFormat: 0 + m_AccurateGbufferNormals: 0 + m_IntermediateTextureMode: 0 +--- !u!114 &7891264069566464977 +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: d69a19d29ef66464ea0afc7cd84fd6c2, type: 3} + m_Name: VolumetricFogRendererFeature + m_EditorClassIdentifier: + m_Active: 1 + downsampleDepthShader: {fileID: 4800000, guid: cffeaeec0396a2c4dad475266cc8dfeb, type: 3} + volumetricFogShader: {fileID: 4800000, guid: 08f816187f9af0244a95556ee0cab83f, type: 3} diff --git a/Basis/Assets/AddressableAssetsData/link.xml.meta b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/QuestRenderer.asset.meta similarity index 52% rename from Basis/Assets/AddressableAssetsData/link.xml.meta rename to Basis/Assets/Basis/Settings/Unity Rendering Defaults/QuestRenderer.asset.meta index 438bf832d..f61c690aa 100644 --- a/Basis/Assets/AddressableAssetsData/link.xml.meta +++ b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/QuestRenderer.asset.meta @@ -1,7 +1,8 @@ fileFormatVersion: 2 -guid: 9df7e3f5f6fde2140909e3edaa94ad95 -TextScriptImporter: +guid: dc6efa2bbf91054468277b399108bb90 +NativeFormatImporter: externalObjects: {} + mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset index 622126870..153ceac9c 100644 --- a/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset +++ b/Basis/Assets/Basis/Settings/Unity Rendering Defaults/UniversalRenderPipelineGlobalSettings.asset @@ -36,25 +36,25 @@ MonoBehaviour: - rid: 2858994164428701698 - rid: 2858994164428701699 - rid: 2858994164428701700 - - rid: 3153963431898906765 + - rid: 3153963477245886578 - rid: 2858994164428701702 - rid: 2858994164428701703 - - rid: 3153963431898906766 - - rid: 3153963431898906767 + - rid: 3153963477245886579 + - rid: 3153963477245886580 - rid: 2858994164428701706 - - rid: 3153963431898906768 + - rid: 3153963477245886581 - rid: 2858994164428701708 - - rid: 6147443362521677920 - - rid: 3153963431898906769 - - rid: 3153963431898906770 - - rid: 6147443694684864618 - - rid: 3153963431898906771 - - rid: 3153963431898906772 - - rid: 6147443694684864621 + - rid: 3153963444920385929 + - rid: 3153963477245886582 + - rid: 3153963477245886583 + - rid: 3153963477245886584 + - rid: 3153963477245886585 + - rid: 3153963477245886586 + - rid: 3153963477245886587 - rid: 2858994164428701716 - rid: 2858994164428701717 - rid: 2858994164428701718 - - rid: 3153963431898906773 + - rid: 3153963477245886588 m_RuntimeSettings: m_List: - rid: 2858994164428701698 @@ -64,7 +64,7 @@ MonoBehaviour: - rid: 2858994164428701703 - rid: 2858994164428701706 - rid: 2858994164428701708 - - rid: 6147443362521677920 + - rid: 3153963444920385929 - rid: 2858994164428701716 - rid: 2858994164428701717 - rid: 2858994164428701718 @@ -158,7 +158,20 @@ MonoBehaviour: m_version: 0 m_EnableCompilationCaching: 1 m_EnableValidityChecks: 1 - - rid: 3153963431898906765 + - rid: 3153963444920385929 + type: {class: GPUResidentDrawerResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.GPUDriven.Runtime} + data: + m_Version: 0 + m_InstanceDataBufferCopyKernels: {fileID: 7200000, guid: f984aeb540ded8b4fbb8a2047ab5b2e2, type: 3} + m_InstanceDataBufferUploadKernels: {fileID: 7200000, guid: 53864816eb00f2343b60e1a2c5a262ef, type: 3} + m_TransformUpdaterKernels: {fileID: 7200000, guid: 2a567b9b2733f8d47a700c3c85bed75b, type: 3} + m_WindDataUpdaterKernels: {fileID: 7200000, guid: fde76746e4fd0ed418c224f6b4084114, type: 3} + m_OccluderDepthPyramidKernels: {fileID: 7200000, guid: 08b2b5fb307b0d249860612774a987da, type: 3} + m_InstanceOcclusionCullingKernels: {fileID: 7200000, guid: f6d223acabc2f974795a5a7864b50e6c, type: 3} + m_OcclusionCullingDebugKernels: {fileID: 7200000, guid: b23e766bcf50ca4438ef186b174557df, type: 3} + m_DebugOcclusionTestPS: {fileID: 4800000, guid: d3f0849180c2d0944bc71060693df100, type: 3} + m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248, type: 3} + - rid: 3153963477245886578 type: {class: Renderer2DResources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 @@ -173,14 +186,14 @@ MonoBehaviour: m_DefaultLitMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} m_DefaultUnlitMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} m_DefaultMaskMaterial: {fileID: 2100000, guid: 15d0c3709176029428a0da2f8cecf0b5, type: 2} - - rid: 3153963431898906766 + - rid: 3153963477245886579 type: {class: URPShaderStrippingSetting, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_Version: 0 m_StripUnusedPostProcessingVariants: 1 m_StripUnusedVariants: 1 m_StripScreenCoordOverrideVariants: 1 - - rid: 3153963431898906767 + - rid: 3153963477245886580 type: {class: UniversalRenderPipelineEditorMaterials, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_DefaultMaterial: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} @@ -189,7 +202,7 @@ MonoBehaviour: m_DefaultTerrainMaterial: {fileID: 2100000, guid: 594ea882c5a793440b60ff72d896021e, type: 2} m_DefaultDecalMaterial: {fileID: 2100000, guid: 31d0dcc6f2dd4e4408d18036a2c93862, type: 2} m_DefaultSpriteMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2} - - rid: 3153963431898906768 + - rid: 3153963477245886581 type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} data: m_AutodeskInteractive: {fileID: 4800000, guid: 0e9d5a909a1f7e84882a534d0d11e49f, type: 3} @@ -201,13 +214,13 @@ MonoBehaviour: m_DefaultSpeedTree7Shader: {fileID: 4800000, guid: 0f4122b9a743b744abe2fb6a0a88868b, type: 3} m_DefaultSpeedTree8Shader: {fileID: -6465566751694194690, guid: 9920c1f1781549a46ba081a2a15a16ec, type: 3} m_DefaultSpeedTree9Shader: {fileID: -6465566751694194690, guid: cbd3e1cc4ae141c42a30e33b4d666a61, type: 3} - - rid: 3153963431898906769 + - rid: 3153963477245886582 type: {class: STP/RuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_setupCS: {fileID: 7200000, guid: 33be2e9a5506b2843bdb2bdff9cad5e1, type: 3} m_preTaaCS: {fileID: 7200000, guid: a679dba8ec4d9ce45884a270b0e22dda, type: 3} m_taaCS: {fileID: 7200000, guid: 3923900e2b41b5e47bc25bfdcbcdc9e6, type: 3} - - rid: 3153963431898906770 + - rid: 3153963477245886583 type: {class: ProbeVolumeBakingResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -220,7 +233,12 @@ MonoBehaviour: skyOcclusionRT: {fileID: -5126288278712620388, guid: 5a2a534753fbdb44e96c3c78b5a6999d, type: 3} renderingLayerCS: {fileID: -6772857160820960102, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} renderingLayerRT: {fileID: -5126288278712620388, guid: 94a070d33e408384bafc1dea4a565df9, type: 3} - - rid: 3153963431898906771 + - rid: 3153963477245886584 + type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} + data: + m_Version: 1 + m_ProbeVolumeDisableStreamingAssets: 1 + - rid: 3153963477245886585 type: {class: ProbeVolumeDebugResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 @@ -230,39 +248,21 @@ MonoBehaviour: probeVolumeOffsetDebugShader: {fileID: 4800000, guid: db8bd7436dc2c5f4c92655307d198381, type: 3} probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 20be25aac4e22ee49a7db76fb3df6de2, type: 3} numbersDisplayTex: {fileID: 2800000, guid: 73fe53b428c5b3440b7e87ee830b608a, type: 3} - - rid: 3153963431898906772 + - rid: 3153963477245886586 type: {class: IncludeAdditionalRPAssets, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_version: 0 m_IncludeReferencedInScenes: 0 m_IncludeAssetsByLabel: 0 m_LabelToInclude: - - rid: 3153963431898906773 - type: {class: UniversalRenderPipelineEditorAssets, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} - data: - m_DefaultSettingsVolumeProfile: {fileID: 11400000, guid: eda47df5b85f4f249abf7abd73db2cb2, type: 2} - - rid: 6147443362521677920 - type: {class: GPUResidentDrawerResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.GPUDriven.Runtime} - data: - m_Version: 0 - m_InstanceDataBufferCopyKernels: {fileID: 7200000, guid: f984aeb540ded8b4fbb8a2047ab5b2e2, type: 3} - m_InstanceDataBufferUploadKernels: {fileID: 7200000, guid: 53864816eb00f2343b60e1a2c5a262ef, type: 3} - m_TransformUpdaterKernels: {fileID: 7200000, guid: 2a567b9b2733f8d47a700c3c85bed75b, type: 3} - m_WindDataUpdaterKernels: {fileID: 7200000, guid: fde76746e4fd0ed418c224f6b4084114, type: 3} - m_OccluderDepthPyramidKernels: {fileID: 7200000, guid: 08b2b5fb307b0d249860612774a987da, type: 3} - m_InstanceOcclusionCullingKernels: {fileID: 7200000, guid: f6d223acabc2f974795a5a7864b50e6c, type: 3} - m_OcclusionCullingDebugKernels: {fileID: 7200000, guid: b23e766bcf50ca4438ef186b174557df, type: 3} - m_DebugOcclusionTestPS: {fileID: 4800000, guid: d3f0849180c2d0944bc71060693df100, type: 3} - m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248, type: 3} - - rid: 6147443694684864618 - type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} - data: - m_Version: 1 - m_ProbeVolumeDisableStreamingAssets: 1 - - rid: 6147443694684864621 + - rid: 3153963477245886587 type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime} data: m_Version: 1 probeVolumeBlendStatesCS: {fileID: 7200000, guid: a3f7b8c99de28a94684cb1daebeccf5d, type: 3} probeVolumeUploadDataCS: {fileID: 7200000, guid: 0951de5992461754fa73650732c4954c, type: 3} probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931, type: 3} + - rid: 3153963477245886588 + type: {class: UniversalRenderPipelineEditorAssets, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime} + data: + m_DefaultSettingsVolumeProfile: {fileID: 11400000, guid: eda47df5b85f4f249abf7abd73db2cb2, type: 2} diff --git a/Basis/Packages/com.avionblock.opussharp/OpusSharp.Core/NativeOpus.cs b/Basis/Packages/com.avionblock.opussharp/OpusSharp.Core/NativeOpus.cs index a4c7d5a8f..d3c20c21b 100644 --- a/Basis/Packages/com.avionblock.opussharp/OpusSharp.Core/NativeOpus.cs +++ b/Basis/Packages/com.avionblock.opussharp/OpusSharp.Core/NativeOpus.cs @@ -1,4 +1,4 @@ -using OpusSharp.Core.SafeHandlers; +using OpusSharp.Core.SafeHandlers; using System; using System.Runtime.InteropServices; namespace OpusSharp.Core diff --git a/Basis/Packages/com.basis.framework/Device Management/Device Configuration/BasisDeviceLoaderAndSaver.cs b/Basis/Packages/com.basis.framework/Device Management/Device Configuration/BasisDeviceLoaderAndSaver.cs index 309e0aad7..cec88c843 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Device Configuration/BasisDeviceLoaderAndSaver.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Device Configuration/BasisDeviceLoaderAndSaver.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Security.Cryptography; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using UnityEngine; @@ -91,11 +92,20 @@ public static void SaveDevices(string directoryPath, List SaveDeviceAsync(filePath, device)); } } + public static string MakeDeviceSafeForSave(string fileName) + { + // Define a regex pattern to match invalid filename characters + string invalidChars = new string(Path.GetInvalidFileNameChars()) + "{}"; + string pattern = $"[{Regex.Escape(invalidChars)}]"; + // Replace invalid characters with an underscore + return Regex.Replace(fileName, pattern, "_"); + } public static void SaveDeviceAsync(string filePath, BasisDeviceMatchSettings device) { try diff --git a/Basis/Packages/com.basis.framework/Microphone/BasisAudioDecoder.cs b/Basis/Packages/com.basis.framework/Microphone/BasisAudioDecoder.cs deleted file mode 100644 index 114a27351..000000000 --- a/Basis/Packages/com.basis.framework/Microphone/BasisAudioDecoder.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -public class BasisAudioDecoder -{ - public event Action OnDecoded; - OpusSharp.Core.OpusDecoder decoder; - public float[] pcmBuffer; - public int pcmLength; - public int FakepcmLength; - public void Initialize() - { - FakepcmLength = 2048; - pcmLength = 2048; - pcmBuffer = new float[FakepcmLength * (int)BasisOpusSettings.NumChannels];//AudioDecoder.maximumPacketDuration now its 2048 - decoder = new OpusSharp.Core.OpusDecoder(BasisOpusSettings.SampleFreqToInt(), BasisOpusSettings.NumChannels); - } - public void Deinitalize() - { - decoder.Dispose(); - decoder = null; - } - - /// - /// decodes data into the pcm buffer - /// note that the pcm buffer is always going to have more data then submited. - /// the pcm length is how much was actually encoded. - /// - /// - public void OnDecode(byte[] data, int length) - { - //960 20ms - pcmLength = decoder.Decode(data, length, pcmBuffer, 960, false); - OnDecoded?.Invoke(); - } -} diff --git a/Basis/Packages/com.basis.framework/Microphone/BasisAudioDecoder.cs.meta b/Basis/Packages/com.basis.framework/Microphone/BasisAudioDecoder.cs.meta deleted file mode 100644 index 6e2391e4a..000000000 --- a/Basis/Packages/com.basis.framework/Microphone/BasisAudioDecoder.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 24bb390bd3ee64d4da59b34593481b49 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs index 0d141756d..71d5126d4 100644 --- a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs +++ b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorder.cs @@ -26,19 +26,6 @@ public bool TryInitialize() { if (!IsInitialize) { - processBufferArray = BasisOpusSettings.CalculateProcessBuffer(); - PBA = new NativeArray(processBufferArray, Allocator.Persistent); - VAJ = new LogarithmicVolumeAdjustmentJob - { - processBufferArray = PBA, - Volume = Volume - }; - ProcessBufferLength = processBufferArray.Length; - samplingFrequency = BasisOpusSettings.GetSampleFreq(); - microphoneBufferArray = new float[BasisOpusSettings.RecordingFullLength * samplingFrequency]; - rmsValues = new float[rmsWindowSize]; - bufferLength = microphoneBufferArray.Length; - PacketSize = ProcessBufferLength * 4; if (!HasEvents) { SMDMicrophone.OnMicrophoneChanged += ResetMicrophones; @@ -47,10 +34,8 @@ public bool TryInitialize() BasisDeviceManagement.Instance.OnBootModeChanged += OnBootModeChanged; HasEvents = true; } - ChangeMicrophoneVolume(SMDMicrophone.SelectedVolumeMicrophone); ResetMicrophones(SMDMicrophone.SelectedMicrophone); ConfigureDenoiser(SMDMicrophone.SelectedDenoiserMicrophone); - StartProcessingThread(); // Start the processing thread once IsInitialize = true; return true; @@ -86,7 +71,8 @@ private void OnBootModeChanged(string mode) { ResetMicrophones(SMDMicrophone.SelectedMicrophone); } - + public int minFreq = 48000; + public int maxFreq = 48000; public void ResetMicrophones(string newMicrophone) { if (string.IsNullOrEmpty(newMicrophone)) @@ -115,8 +101,25 @@ public void ResetMicrophones(string newMicrophone) if (!IsPaused) { BasisDebug.Log("Starting Microphone :" + newMicrophone); - clip = Microphone.Start(newMicrophone, true, BasisOpusSettings.RecordingFullLength, samplingFrequency); + + Microphone.GetDeviceCaps(newMicrophone, out minFreq, out maxFreq); + LocalOpusSettings.SetDeviceAudioConfig(maxFreq); + + clip = Microphone.Start(newMicrophone, true, LocalOpusSettings.RecordingFullLength, LocalOpusSettings.MicrophoneSampleRate); + microphoneBufferArray = new float[LocalOpusSettings.RecordingFullLength * LocalOpusSettings.MicrophoneSampleRate]; MicrophoneIsStarted = true; + processBufferArray = LocalOpusSettings.CalculateProcessBuffer(); + PBA = new NativeArray(processBufferArray, Allocator.Persistent); + VAJ = new LogarithmicVolumeAdjustmentJob + { + processBufferArray = PBA, + Volume = Volume + }; + ProcessBufferLength = processBufferArray.Length; + rmsValues = new float[LocalOpusSettings.rmsWindowSize]; + bufferLength = microphoneBufferArray.Length; + PacketSize = ProcessBufferLength * 4; + ChangeMicrophoneVolume(SMDMicrophone.SelectedVolumeMicrophone); } else { @@ -349,11 +352,11 @@ public void RollingRMS() { float rms = GetRMS(); rmsValues[rmsIndex] = rms; - rmsIndex = (rmsIndex + 1) % rmsWindowSize; + rmsIndex = (rmsIndex + 1) % LocalOpusSettings.rmsWindowSize; averageRms = rmsValues.Average(); } public bool IsTransmitWorthy() { - return averageRms > silenceThreshold; + return averageRms > LocalOpusSettings.silenceThreshold; } } diff --git a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs index 923b59232..c7767762e 100644 --- a/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs +++ b/Basis/Packages/com.basis.framework/Microphone/MicrophoneRecorderBase.cs @@ -7,20 +7,15 @@ public abstract class MicrophoneRecorderBase : MonoBehaviour public AudioClip clip; public bool IsInitialize = false; public string MicrophoneDevice = null; - public float silenceThreshold = 0.0007f; // RMS threshold for detecting silence - public int samplingFrequency; public int ProcessBufferLength; public float Volume = 1; // Volume adjustment factor, default to 1 (no adjustment) [HideInInspector] public float[] microphoneBufferArray; [HideInInspector] public float[] processBufferArray; - public float noiseGateThreshold = 0.01f; // Threshold for the noise gate - public int Channels = 1; [HideInInspector] public float[] rmsValues; public int rmsIndex = 0; - public int rmsWindowSize = 10; // Size of the moving average window public float averageRms; #if !UNITY_ANDROID public RNNoise.NET.Denoiser Denoiser = new RNNoise.NET.Denoiser(); diff --git a/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs b/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs index 361c5aab8..a8c014f3e 100644 --- a/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs +++ b/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs @@ -14,9 +14,9 @@ public static class BasisNetworkSpawnItem { - public static bool RequestSceneLoad(string UnlockPassword, string BundleURL, string MetaURL, bool IsLocal, bool Persist, out LocalLoadResource localLoadResource) + public static bool RequestSceneLoad(string UnlockPassword, string CombinedURL, bool IsLocal, bool Persist, out LocalLoadResource localLoadResource) { - if (string.IsNullOrEmpty(BundleURL) || string.IsNullOrEmpty(MetaURL) || string.IsNullOrEmpty(UnlockPassword)) + if (string.IsNullOrEmpty(CombinedURL) || string.IsNullOrEmpty(UnlockPassword)) { BasisDebug.Log("Invalid parameters for scene load request.", BasisDebug.LogTag.Networking); localLoadResource = new LocalLoadResource(); @@ -29,9 +29,8 @@ public static bool RequestSceneLoad(string UnlockPassword, string BundleURL, str { LoadedNetID = BasisGenerateUniqueID.GenerateUniqueID(), Mode = 1, - BundleURL = BundleURL, + CombinedURL = CombinedURL, UnlockPassword = UnlockPassword, - MetaURL = MetaURL, IsLocalLoad = IsLocal, Persist = Persist, }; @@ -45,9 +44,9 @@ public static bool RequestSceneLoad(string UnlockPassword, string BundleURL, str return true; } - public static bool RequestGameObjectLoad(string UnlockPassword, string BundleURL, string MetaURL, bool IsLocal, Vector3 Position, Quaternion Rotation, Vector3 Scale, bool Persistent,bool ModifysScale, out LocalLoadResource LocalLoadResource) + public static bool RequestGameObjectLoad(string UnlockPassword, string CombinedURL, bool IsLocal, Vector3 Position, Quaternion Rotation, Vector3 Scale, bool Persistent,bool ModifysScale, out LocalLoadResource LocalLoadResource) { - if (string.IsNullOrEmpty(BundleURL) || string.IsNullOrEmpty(MetaURL) || string.IsNullOrEmpty(UnlockPassword)) + if (string.IsNullOrEmpty(CombinedURL) || string.IsNullOrEmpty(UnlockPassword)) { BasisDebug.Log("Invalid parameters for GameObject load request.", BasisDebug.LogTag.Networking); LocalLoadResource = new LocalLoadResource(); @@ -60,9 +59,8 @@ public static bool RequestGameObjectLoad(string UnlockPassword, string BundleURL { LoadedNetID = BasisGenerateUniqueID.GenerateUniqueID(), Mode = 0, - BundleURL = BundleURL, + CombinedURL = CombinedURL, UnlockPassword = UnlockPassword, - MetaURL = MetaURL, IsLocalLoad = IsLocal, PositionX = Position.x, PositionY = Position.y, @@ -138,7 +136,7 @@ public static async Task SpawnScene(LocalLoadResource localLoadResource) BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle() { IsLocal = localLoadResource.IsLocalLoad, - CombinedURL = localLoadResource.MetaURL + CombinedURL = localLoadResource.CombinedURL }, UnlockPassword = localLoadResource.UnlockPassword, }; @@ -172,7 +170,7 @@ public static async Task SpawnGameObject(LocalLoadResource localLoad BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle() { IsLocal = localLoadResource.IsLocalLoad, - CombinedURL = localLoadResource.MetaURL + CombinedURL = localLoadResource.CombinedURL }, UnlockPassword = localLoadResource.UnlockPassword, }; diff --git a/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs b/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs index c1ce2eb4c..7f53d2740 100644 --- a/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs +++ b/Basis/Packages/com.basis.framework/Networking/Compression/BasisOpusSettings.cs @@ -1,25 +1,54 @@ using OpusSharp.Core; using UnityEngine; -public static class BasisOpusSettings + +public static class LocalOpusSettings { public static int RecordingFullLength = 1; - public static int NumChannels = 1; public static OpusPredefinedValues OpusApplication = OpusPredefinedValues.OPUS_APPLICATION_AUDIO; public static float DesiredDurationInSeconds = 0.02f; - public static int GetSampleFreq() + public static int MicrophoneSampleRate { get; private set; } = 48000; + /// + /// we only ever need one channel + /// + public static int Channels { get; private set; } = 1; + + public static float noiseGateThreshold = 0.01f; + public static float silenceThreshold = 0.0007f; + public static int rmsWindowSize = 10; + public static void SetDeviceAudioConfig(int maxFreq) { - return SampleFreqToInt(); + MicrophoneSampleRate = maxFreq; } - public static int CalculateDesiredTime() + public static int SampleRate() { - return Mathf.CeilToInt(DesiredDurationInSeconds * GetSampleFreq()); + return (int) Mathf.CeilToInt(DesiredDurationInSeconds * MicrophoneSampleRate); } public static float[] CalculateProcessBuffer() { - return new float[CalculateDesiredTime()]; + return new float[SampleRate()]; } - public static int SampleFreqToInt() +} + +public static class RemoteOpusSettings +{ + public static OpusPredefinedValues OpusApplication = OpusPredefinedValues.OPUS_APPLICATION_AUDIO; + public static float DesiredDurationInSeconds = 0.02f; + public const int NetworkSampleRate = 48000; + public static int PlayBackSampleRate = AudioSettings.outputSampleRate; + /// + /// we only ever need one channel + /// + public static int Channels { get; private set; } = 1; + public static int SampleLength => NetworkSampleRate * Channels; + public static int Pcmlength => CalculatePCMSize(); + public static int RecieverLength => Pcmlength * 2; + public static int RecieverLengthCapacity => RecieverLength * 2; + /// + /// 960 by default + /// + /// + private static int CalculatePCMSize() { - return 48000; + return Mathf.CeilToInt(DesiredDurationInSeconds * NetworkSampleRate); } } diff --git a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiver.cs b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiver.cs index 4c07953c0..095211f2e 100644 --- a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiver.cs +++ b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiver.cs @@ -1,17 +1,38 @@ using Basis.Scripts.BasisSdk.Helpers; using Basis.Scripts.BasisSdk.Players; -using Basis.Scripts.Device_Management; using Basis.Scripts.Drivers; using Basis.Scripts.Networking.NetworkedAvatar; +using OpusSharp.Core; using System; using UnityEngine; namespace Basis.Scripts.Networking.Recievers { [System.Serializable] - public class BasisAudioReceiver : BasisAudioReceiverBase + public class BasisAudioReceiver { public BasisRemoteAudioDriver BasisRemoteVisemeAudioDriver; + public OpusDecoder decoder; + [SerializeField] + public AudioSource audioSource; + [SerializeField] + public BasisAudioAndVisemeDriver visemeDriver; + [SerializeField] + public BasisVoiceRingBuffer RingBuffer; + public bool IsPlaying = false; + public float[] pcmBuffer; + public int pcmLength; + /// + /// decodes data into the pcm buffer + /// note that the pcm buffer is always going to have more data then submited. + /// the pcm length is how much was actually encoded. + /// + /// + public void OnDecode(byte[] data, int length) + { + pcmLength = decoder.Decode(data, length, pcmBuffer, RemoteOpusSettings.NetworkSampleRate, false); + OnDecoded(); + } public void OnEnable(BasisNetworkPlayer networkedPlayer) { // Initialize settings and audio source @@ -26,23 +47,16 @@ public void OnEnable(BasisNetworkPlayer networkedPlayer) audioSource.dopplerLevel = 0; audioSource.volume = 1.0f; audioSource.loop = true; - // Initialize sampling parameters - samplingFrequency = BasisOpusSettings.GetSampleFreq(); - numChannels = 1; - SampleLength = samplingFrequency * numChannels; - RingBuffer = new RingBuffer(4096*2); + RingBuffer = new BasisVoiceRingBuffer(RemoteOpusSettings.RecieverLengthCapacity); // Create AudioClip - audioSource.clip = AudioClip.Create($"player [{networkedPlayer.NetId}]", 4096, numChannels, samplingFrequency, false, (buf) => + audioSource.clip = AudioClip.Create($"player [{networkedPlayer.NetId}]", RemoteOpusSettings.RecieverLength, RemoteOpusSettings.Channels, RemoteOpusSettings.PlayBackSampleRate, false, (buf) => { Array.Fill(buf, 1.0f); }); // Ensure decoder is initialized and subscribe to events - if (decoder == null) - { - decoder = new BasisAudioDecoder(); - decoder.Initialize(); - } - decoder.OnDecoded += OnDecoded; + pcmLength = RemoteOpusSettings.Pcmlength; + pcmBuffer = new float[RemoteOpusSettings.SampleLength]; + decoder = new OpusDecoder(RemoteOpusSettings.NetworkSampleRate, RemoteOpusSettings.Channels); StartAudio(); // Perform calibration @@ -53,15 +67,14 @@ public void OnDestroy() // Unsubscribe from events on destroy if (decoder != null) { - decoder.OnDecoded -= OnDecoded; - decoder.Deinitalize(); + decoder.Dispose(); + decoder = null; } if (audioSource != null) { audioSource.Stop(); GameObject.Destroy(audioSource); } - if (visemeDriver != null) { GameObject.Destroy(visemeDriver); @@ -82,5 +95,90 @@ public void OnCalibration(BasisNetworkPlayer networkedPlayer) } BasisRemoteVisemeAudioDriver.Initalize(visemeDriver); } + public void OnDecoded() + { + OnDecoded(pcmBuffer, pcmLength); + } + public void StopAudio() + { + IsPlaying = false; + // audioSource.enabled = false; + audioSource.Stop(); + } + public void StartAudio() + { + IsPlaying = true; + // audioSource.enabled = true; + audioSource.Play(); + } + public void OnDecoded(float[] pcm, int length) + { + RingBuffer.Add(pcm, length); + } + public int OnAudioFilterRead(float[] data, int channels) + { + int length = data.Length; + int frames = length / channels; // Number of audio frames + + if (RingBuffer.IsEmpty) + { + // No voice data, fill with silence + Array.Fill(data, 0); + return length; + } + int outputSampleRate = RemoteOpusSettings.PlayBackSampleRate; + + // If no resampling is needed, process as usual + if (RemoteOpusSettings.NetworkSampleRate == outputSampleRate) + { + RingBuffer.Remove(frames, out float[] segment); + for (int i = 0; i < frames; i++) + { + float sample = segment[i]; // Single-channel sample from the RingBuffer + for (int c = 0; c < channels; c++) + { + int index = i * channels + c; + data[index] *= sample; + } + } + RingBuffer.BufferedReturn.Enqueue(segment); + return length; + } + + // Resampling required + float resampleRatio = (float)RemoteOpusSettings.NetworkSampleRate / outputSampleRate; + int neededFrames = Mathf.CeilToInt(frames * resampleRatio); + + RingBuffer.Remove(neededFrames, out float[] inputSegment); + + // Resampling using linear interpolation + float[] resampledSegment = new float[frames]; + for (int i = 0; i < frames; i++) + { + float srcIndex = i * resampleRatio; + int indexLow = Mathf.FloorToInt(srcIndex); + int indexHigh = Mathf.CeilToInt(srcIndex); + float frac = srcIndex - indexLow; + + float sampleLow = (indexLow < inputSegment.Length) ? inputSegment[indexLow] : 0; + float sampleHigh = (indexHigh < inputSegment.Length) ? inputSegment[indexHigh] : 0; + + resampledSegment[i] = Mathf.Lerp(sampleLow, sampleHigh, frac); + } + + // Apply resampled audio to output buffer + for (int i = 0; i < frames; i++) + { + float sample = resampledSegment[i]; + for (int c = 0; c < channels; c++) + { + int index = i * channels + c; + data[index] *= sample; + } + } + + RingBuffer.BufferedReturn.Enqueue(inputSegment); + return length; + } } } diff --git a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiverBase.cs.meta b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiverBase.cs.meta deleted file mode 100644 index cdf40e8cb..000000000 --- a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiverBase.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: b8ddc161460507549b007b3887831171 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs index 604eb36b9..744f501f6 100644 --- a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs +++ b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisNetworkReceiver.cs @@ -251,7 +251,7 @@ public void ReceiveNetworkAudio(ServerAudioSegmentMessage audioSegment) if (AudioReceiverModule.decoder != null) { BasisNetworkProfiler.ServerAudioSegmentMessageCounter.Sample(audioSegment.audioSegmentData.LengthUsed); - AudioReceiverModule.decoder.OnDecode(audioSegment.audioSegmentData.buffer, audioSegment.audioSegmentData.LengthUsed); + AudioReceiverModule.OnDecode(audioSegment.audioSegmentData.buffer, audioSegment.audioSegmentData.LengthUsed); Player.AudioReceived?.Invoke(true); } } @@ -259,13 +259,13 @@ public void ReceiveSilentNetworkAudio(ServerAudioSegmentMessage audioSilentSegme { if (AudioReceiverModule.decoder != null) { - if (silentData == null || silentData.Length != AudioReceiverModule.decoder.FakepcmLength) + if (silentData == null || silentData.Length != RemoteOpusSettings.Pcmlength) { - silentData = new float[AudioReceiverModule.decoder.FakepcmLength]; + silentData = new float[RemoteOpusSettings.Pcmlength]; Array.Fill(silentData, 0f); } BasisNetworkProfiler.ServerAudioSegmentMessageCounter.Sample(1); - AudioReceiverModule.OnDecoded(silentData, AudioReceiverModule.decoder.FakepcmLength); + AudioReceiverModule.OnDecoded(silentData, RemoteOpusSettings.Pcmlength); Player.AudioReceived?.Invoke(false); } } @@ -332,12 +332,6 @@ public void ForceUpdateFilters() DerivativeFilters = derivativeFilters, }; } - private float Alpha(float cutoff) - { - float te = 1.0f / (1.0f / interpolationTime); - float tau = 1.0f / (2.0f * Mathf.PI * cutoff); - return 1.0f / (1.0f + tau / te); - } public void OnCalibration() { AudioReceiverModule.OnCalibration(this); diff --git a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiverBase.cs b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisVoiceRingBuffer.cs similarity index 64% rename from Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiverBase.cs rename to Basis/Packages/com.basis.framework/Networking/Recievers/BasisVoiceRingBuffer.cs index ccdd297a8..3cdacb2b8 100644 --- a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisAudioReceiverBase.cs +++ b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisVoiceRingBuffer.cs @@ -1,83 +1,10 @@ -using Basis.Scripts.Drivers; using System; -using System.Collections; using System.Collections.Generic; using System.Threading; -using UnityEngine; namespace Basis.Scripts.Networking.Recievers { - public partial class BasisAudioReceiverBase - { - [SerializeField] - public BasisAudioDecoder decoder; - [SerializeField] - public AudioSource audioSource; - [SerializeField] - public BasisAudioAndVisemeDriver visemeDriver; - [SerializeField] - public RingBuffer RingBuffer; - public int samplingFrequency; - public int numChannels; - public int SampleLength; - public bool IsPlaying = false; - public void OnDecoded() - { - OnDecoded(decoder.pcmBuffer, decoder.pcmLength); - } - public void StopAudio() - { - IsPlaying = false; - // audioSource.enabled = false; - audioSource.Stop(); - } - public void StartAudio() - { - IsPlaying = true; - // audioSource.enabled = true; - audioSource.Play(); - } - public void OnDecoded(float[] pcm, int length) - { - RingBuffer.Add(pcm, length); - } - public int OnAudioFilterRead(float[] data, int channels) - { - // Ensure we have enough data for the required samples - int length = data.Length; - int frames = length / channels; // Number of audio frames - - // If no data in the buffer, clear the output - if (RingBuffer.IsEmpty) - { - // No voice data, fill with silence - Array.Fill(data, 0); - return length; - } - - // Retrieve the segment of audio data from the RingBuffer - RingBuffer.Remove(frames, out float[] segment); - - // Apply the filter: multiply the existing data by the generated samples - for (int i = 0; i < frames; i++) - { - float sample = segment[i]; // Single-channel sample from the RingBuffer - - for (int c = 0; c < channels; c++) - { - int index = i * channels + c; - - // Multiply existing data with the sample - data[index] *= sample; - } - } - - // Return the processed segment back to the buffer for reuse - RingBuffer.BufferedReturn.Enqueue(segment); - return length; - } - } - public class RingBuffer + public class BasisVoiceRingBuffer { private readonly float[] buffer; private int head; // Points to the next position to write @@ -86,7 +13,7 @@ public class RingBuffer private readonly object bufferLock = new(); public Queue BufferedReturn = new Queue(); - public RingBuffer(int capacity) + public BasisVoiceRingBuffer(int capacity) { if (capacity <= 0) throw new ArgumentException("Capacity must be greater than zero."); buffer = new float[capacity]; diff --git a/Basis/Packages/com.basis.framework/Networking/Recievers/BasisVoiceRingBuffer.cs.meta b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisVoiceRingBuffer.cs.meta new file mode 100644 index 000000000..786993117 --- /dev/null +++ b/Basis/Packages/com.basis.framework/Networking/Recievers/BasisVoiceRingBuffer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: b8760c80397cef94c80dbe713c425669 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs b/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs index 66a5cd551..94069248a 100644 --- a/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs +++ b/Basis/Packages/com.basis.framework/Networking/Transmitters/BasisAudioTransmission.cs @@ -19,9 +19,10 @@ public class BasisAudioTransmission public MicrophoneRecorder Recorder; public bool IsInitalized = false; + public bool HasEvents = false; + public AudioSegmentDataMessage AudioSegmentData = new AudioSegmentDataMessage(); public AudioSegmentDataMessage audioSilentSegmentData = new AudioSegmentDataMessage(); - public bool HasEvents = false; public void OnEnable(BasisNetworkPlayer networkedPlayer) { if (!IsInitalized) @@ -31,7 +32,7 @@ public void OnEnable(BasisNetworkPlayer networkedPlayer) // Initialize the Opus encoder with the retrieved settings - encoder = new OpusEncoder(BasisOpusSettings.SampleFreqToInt(), BasisOpusSettings.NumChannels, BasisOpusSettings.OpusApplication); + encoder = new OpusEncoder(LocalOpusSettings.MicrophoneSampleRate, LocalOpusSettings.Channels, LocalOpusSettings.OpusApplication); // Cast the networked player to a local player to access the microphone recorder Local = (BasisLocalPlayer)networkedPlayer.Player; Recorder = Local.MicrophoneRecorder; @@ -46,9 +47,9 @@ public void OnEnable(BasisNetworkPlayer networkedPlayer) MicrophoneRecorder.OnHasSilence += SendSilenceOverNetwork; HasEvents = true; // Ensure the output buffer is properly initialized and matches the packet size - if (AudioSegmentData.buffer == null || Recorder.PacketSize != AudioSegmentData.buffer.Length) + if (Recorder.PacketSize != AudioSegmentData.TotalLength) { - AudioSegmentData.buffer = new byte[Recorder.PacketSize]; + AudioSegmentData = new AudioSegmentDataMessage(new byte[Recorder.PacketSize]); } } } @@ -71,21 +72,22 @@ public void OnDisable() encoder.Dispose(); encoder = null; } + public const DeliveryMethod AudioSendMethod = DeliveryMethod.Sequenced; public void OnAudioReady() { if (NetworkedPlayer.HasReasonToSendAudio) { // UnityEngine.BasisDebug.Log("Sending out Audio"); - if (Recorder.PacketSize != AudioSegmentData.buffer.Length) + if (Recorder.PacketSize != AudioSegmentData.TotalLength) { - AudioSegmentData.buffer = new byte[Recorder.PacketSize]; + AudioSegmentData = new AudioSegmentDataMessage(new byte[Recorder.PacketSize]); } // Encode the audio data from the microphone recorder's buffer - AudioSegmentData.LengthUsed = encoder.Encode(Recorder.processBufferArray,960, AudioSegmentData.buffer, AudioSegmentData.buffer.Length); + AudioSegmentData.LengthUsed = encoder.Encode(Recorder.processBufferArray, LocalOpusSettings.SampleRate(), AudioSegmentData.buffer, AudioSegmentData.TotalLength); NetDataWriter writer = new NetDataWriter(); AudioSegmentData.Serialize(writer); BasisNetworkProfiler.AudioSegmentDataMessageCounter.Sample(AudioSegmentData.LengthUsed); - BasisNetworkManagement.LocalPlayerPeer.Send(writer, BasisNetworkCommons.VoiceChannel, DeliveryMethod.Sequenced); + BasisNetworkManagement.LocalPlayerPeer.Send(writer, BasisNetworkCommons.VoiceChannel, AudioSendMethod); Local.AudioReceived?.Invoke(true); } else @@ -101,7 +103,7 @@ private void SendSilenceOverNetwork() audioSilentSegmentData.LengthUsed = 0; audioSilentSegmentData.Serialize(writer); BasisNetworkProfiler.AudioSegmentDataMessageCounter.Sample(writer.Length); - BasisNetworkManagement.LocalPlayerPeer.Send(writer, BasisNetworkCommons.VoiceChannel, DeliveryMethod.Sequenced); + BasisNetworkManagement.LocalPlayerPeer.Send(writer, BasisNetworkCommons.VoiceChannel, AudioSendMethod); Local.AudioReceived?.Invoke(false); } } diff --git a/Basis/Packages/com.basis.framework/SettingsManagerModules/Basis Modules/SMModuleRenderResolutionURP.cs b/Basis/Packages/com.basis.framework/SettingsManagerModules/Basis Modules/SMModuleRenderResolutionURP.cs index 9d3ea4386..fc77cacfb 100644 --- a/Basis/Packages/com.basis.framework/SettingsManagerModules/Basis Modules/SMModuleRenderResolutionURP.cs +++ b/Basis/Packages/com.basis.framework/SettingsManagerModules/Basis Modules/SMModuleRenderResolutionURP.cs @@ -26,7 +26,7 @@ public override void ReceiveOption(SettingsMenuInput Option, SettingsManager Man { if (NameReturn(0, Option)) { - // BasisDebug.Log("Render Resolution"); + // BasisDebug.Log("Render Resolution"); UniversalRenderPipelineAsset Asset = (UniversalRenderPipelineAsset)QualitySettings.renderPipeline; if (XRSettings.useOcclusionMesh == false) { @@ -47,20 +47,35 @@ public override void ReceiveOption(SettingsMenuInput Option, SettingsManager Man { if (NameReturn(2, Option)) { - SubsystemManager.GetSubsystems(xrDisplays); - if (xrDisplays.Count == 1) + // BasisDebug.Log("Changing Foveated Rendering"); + SubsystemManager.GetSubsystems(xrDisplays); + + if (xrDisplays.Count == 0) + { + // BasisDebug.LogError("No XR display subsystems found."); + return; + } + foreach (var subsystem in xrDisplays) { - if (SliderReadOption(Option, Manager, out float Value)) + if (subsystem.running) { - xrDisplays[0].foveatedRenderingLevel = Value; // Full strength - xrDisplays[0].foveatedRenderingFlags = XRDisplaySubsystem.FoveatedRenderingFlags.GazeAllowed; + xrDisplaySubsystem = subsystem; + break; } } + xrDisplaySubsystem.foveatedRenderingFlags = XRDisplaySubsystem.FoveatedRenderingFlags.GazeAllowed; + if (SliderReadOption(Option, Manager, out float Value)) + { + // BasisDebug.Log("Changing Foveated Rendering to " + Value); + xrDisplaySubsystem.foveatedRenderingLevel = Value; + } } } } } public float RenderScale = 1; + private XRDisplaySubsystem xrDisplaySubsystem; + public void SetRenderResolution(float renderScale) { #if UNITY_ANDROID diff --git a/Basis/Packages/com.basis.framework/SettingsManagerModules/Save Modules/SMSaveJson.cs b/Basis/Packages/com.basis.framework/SettingsManagerModules/Save Modules/SMSaveJson.cs index c39627497..09ebb1478 100644 --- a/Basis/Packages/com.basis.framework/SettingsManagerModules/Save Modules/SMSaveJson.cs +++ b/Basis/Packages/com.basis.framework/SettingsManagerModules/Save Modules/SMSaveJson.cs @@ -5,15 +5,18 @@ using System.Linq; using System.Text; using UnityEngine; + namespace BattlePhaze.SettingsManager { public class SMSaveJson : SMSaveModuleBase { private string FileExtension = ".json"; + public string GetCurrentFilePath(SettingsManager Manager) { return Path.Combine(Application.persistentDataPath, Manager.ManagerSettings.FileName + FileExtension); } + public override bool Load(SettingsManager Manager, SettingsManagerSaveSystem Save) { string filePath = GetCurrentFilePath(Manager); @@ -24,25 +27,42 @@ public override bool Load(SettingsManager Manager, SettingsManagerSaveSystem Sav using (var reader = new StreamReader(filePath)) { Save.Clear(); - OptionMappings Mappings = JsonUtility.FromJson(reader.ReadToEnd()); - if (Mappings.Information != null) + string jsonData = reader.ReadToEnd(); + + if (string.IsNullOrEmpty(jsonData)) + { + BasisDebug.LogError("File is empty. Deleting corrupted file."); + Delete(Manager, Save); + return false; + } + + OptionMappings Mappings = JsonUtility.FromJson(jsonData); + if (Mappings.Information == null) + { + BasisDebug.LogError("Invalid JSON format. Deleting corrupted file."); + Delete(Manager, Save); + return false; + } + + foreach (var mapping in Mappings.Information) { - for (int MappingIndex = 0; MappingIndex < Mappings.Information.Length; MappingIndex++) - { - Save.Set(Mappings.Information[MappingIndex].key, Mappings.Information[MappingIndex].value, Mappings.Information[MappingIndex].comment); - } + Save.Set(mapping.key, mapping.value, mapping.comment); } } } - catch (IOException e) + catch (Exception e) { - BasisDebug.Log("Impossible to open file nuking : " + filePath); + BasisDebug.LogError($"Failed to read file: {filePath}\n{e.Message}"); BasisDebug.Log(e.StackTrace); Delete(Manager, Save); return false; } } - // BasisDebug.Log("Loading Data json"); + else + { + BasisDebug.LogWarning("File does not exist."); + return false; + } return true; } @@ -50,38 +70,36 @@ public override string ModuleName() { return "JSON"; } + [System.Serializable] public struct OptionMappings { [SerializeField] public SMOptionInformation[] Information; } + public override bool Save(SettingsManager Manager, SettingsManagerSaveSystem Save) { + string filePath = GetCurrentFilePath(Manager); Encoding encoding = Encoding.UTF8; BasisDebug.Log("Saving Data JSON"); - string filePath = GetCurrentFilePath(Manager); try { - OptionMappings mappings = new OptionMappings(); + OptionMappings mappings = new OptionMappings + { + Information = Save.OptionMapping.Values.ToArray() + }; + + string jsonData = JsonUtility.ToJson(mappings, true); using (StreamWriter writer = new StreamWriter(filePath, false, encoding)) { - try - { - mappings.Information = Save.OptionMapping.Values.ToArray(); - string Data = JsonUtility.ToJson(mappings); - writer.Write(Data); - } - catch (Exception ex) - { - BasisDebug.LogError("Error saving file: " + ex.Message); - } + writer.Write(jsonData); } + BasisDebug.Log("Save completed successfully."); } - catch (IOException e) + catch (Exception ex) { - BasisDebug.LogError("Impossible to save file: " + GetCurrentFilePath(Manager)); - Debug.LogWarning(e); + BasisDebug.LogError($"Error saving file: {ex.Message}\n{ex.StackTrace}"); return false; } return true; @@ -89,13 +107,19 @@ public override bool Save(SettingsManager Manager, SettingsManagerSaveSystem Sav public override bool Delete(SettingsManager Manager, SettingsManagerSaveSystem Save) { - if (Manager != null && Save != null) - { - File.Delete(GetCurrentFilePath(Manager)); - } - else + string filePath = GetCurrentFilePath(Manager); + if (File.Exists(filePath)) { - return false; + try + { + File.Delete(filePath); + BasisDebug.Log("File deleted successfully: " + filePath); + } + catch (Exception ex) + { + BasisDebug.LogError($"Failed to delete file: {filePath}\n{ex.Message}"); + return false; + } } return true; } @@ -104,6 +128,7 @@ public override string Location(SettingsManager Manager, SettingsManagerSaveSyst { return GetCurrentFilePath(Manager); } + public override SaveSystemType Type() { return SaveSystemType.Normal; diff --git a/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs b/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs index 3caa24d3e..5bbb7e55d 100644 --- a/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs +++ b/Basis/Packages/com.basis.framework/UI/BasisUIRaycastProcess.cs @@ -66,7 +66,7 @@ public void Simulate() { EventSystem.current.SetSelectedGameObject(null, null); } - + DevicesCount = Inputs.Count; for (int Index = 0; Index < DevicesCount; Index++) { BasisInput input = Inputs[Index]; diff --git a/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab b/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab index 26ffd91db..10a67b66f 100644 --- a/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab +++ b/Basis/Packages/com.basis.sdk/Prefabs/Boot/BootManager.prefab @@ -1999,7 +1999,7 @@ MonoBehaviour: EditorVisable: 1 SupportedRenderPipeline: 030000000400000000000000 Round: 0 - RoundTo: 1 + RoundTo: 0 MaxPercentage: 100 MinPercentage: 0 SliderMaxValue: 1 @@ -2018,11 +2018,11 @@ MonoBehaviour: PlatFormDefaultState: - Platform: 11 GraphicsVendor: 0 - SetString: 0.75 + SetString: 0 ExcludeFromThesePlatforms: [] MasterQualityState: 0 ParseController: 1 - ReturnedValueTextType: 0 + ReturnedValueTextType: 1 SelectableValueList: [] - EditorBasedUIToggles: SupportedRenderPipelines: 1 @@ -2830,10 +2830,10 @@ MonoBehaviour: m_EditorClassIdentifier: Selector: {fileID: 11400000, guid: 8393424ebf34934449c2d1309a700837, type: 2} DefaultScene: - UnlockPassword: 5fbc8c55167d21cc1b57b65724492bfa11b0b71f32eac99f5af03d40e85ccb67 + UnlockPassword: BasisRemoteBundleEncrypted: IsLocal: 0 - CombinedURL: https://BasisFramework.b-cdn.net/Worlds/BEE/ff15e73c52f34d9b9026e264d5744fea20250301.BEE + CombinedURL: BasisLocalEncryptedBundle: LocalConnectorPath: BasisBundleConnector: @@ -2856,4 +2856,4 @@ MonoBehaviour: AssetBundleDescription: BasisBundleGenerated: [] UseAddressablesToLoadScene: 0 - UseSceneProvidedHere: 1 + UseSceneProvidedHere: 0 diff --git a/Basis/Packages/com.basis.sdk/Prefabs/UI/Settings UI.prefab b/Basis/Packages/com.basis.sdk/Prefabs/UI/Settings UI.prefab index 7939ac33d..4b61095d1 100644 --- a/Basis/Packages/com.basis.sdk/Prefabs/UI/Settings UI.prefab +++ b/Basis/Packages/com.basis.sdk/Prefabs/UI/Settings UI.prefab @@ -8075,7 +8075,7 @@ GameObject: - component: {fileID: 1249802655459668493} - component: {fileID: 7847025051690455819} m_Layer: 5 - m_Name: Snap Turn Angle (1) + m_Name: Foveated Rendering m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -8148,10 +8148,10 @@ MonoBehaviour: m_FillRect: {fileID: 2874727187132495823} m_HandleRect: {fileID: 8277659341080951790} m_Direction: 0 - m_MinValue: -1 - m_MaxValue: 90 - m_WholeNumbers: 1 - m_Value: 9 + m_MinValue: 0 + m_MaxValue: 100 + m_WholeNumbers: 0 + m_Value: 1 m_OnValueChanged: m_PersistentCalls: m_Calls: [] @@ -24285,7 +24285,7 @@ GameObject: - component: {fileID: 1294865624923183846} - component: {fileID: 899354375703434185} m_Layer: 5 - m_Name: Memory Allocation (1) + m_Name: Foveated Rendering m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/AudioSegmentDataMessage.cs b/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/AudioSegmentDataMessage.cs index 957726457..8f8bf0970 100644 --- a/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/AudioSegmentDataMessage.cs +++ b/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/AudioSegmentDataMessage.cs @@ -5,7 +5,13 @@ public static partial class SerializableBasis public struct AudioSegmentDataMessage { public byte[] buffer; + public int TotalLength; public int LengthUsed; + public AudioSegmentDataMessage(byte[] buffer) : this() + { + this.buffer = buffer; + TotalLength = buffer.Length; + } public void Deserialize(NetDataReader Writer) { if (Writer.AvailableBytes == 0) @@ -14,17 +20,18 @@ public void Deserialize(NetDataReader Writer) } else { - if (buffer != null && buffer.Length == Writer.AvailableBytes) + if (TotalLength == Writer.AvailableBytes) { Writer.GetBytes(buffer, Writer.AvailableBytes); - LengthUsed = buffer.Length; + LengthUsed = TotalLength; } else { buffer = Writer.GetRemainingBytes(); - LengthUsed = buffer.Length; + TotalLength = buffer.Length; + LengthUsed = TotalLength; } - // BNL.Log("Get Length was " + LengthUsed); + // BNL.Log("Get Length was " + LengthUsed); } } public void Serialize(NetDataWriter Writer) @@ -32,7 +39,7 @@ public void Serialize(NetDataWriter Writer) if (LengthUsed != 0) { Writer.Put(buffer, 0, LengthUsed); - // BNL.Log("Put Length was " + LengthUsed); + // BNL.Log("Put Length was " + LengthUsed); } } } diff --git a/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/ResourceManagementMessage.cs b/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/ResourceManagementMessage.cs index 3bc2d8d64..d6c654570 100644 --- a/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/ResourceManagementMessage.cs +++ b/Basis/Packages/com.basis.server/BasisNetworkCore/Serializable/ResourceManagementMessage.cs @@ -15,8 +15,7 @@ public struct LocalLoadResource /// public string LoadedNetID; public string UnlockPassword; - public string MetaURL; - public string BundleURL; + public string CombinedURL; public bool IsLocalLoad; public float PositionX; @@ -45,8 +44,7 @@ public void Deserialize(NetDataReader Writer) Mode = Writer.GetByte(); LoadedNetID = Writer.GetString(); UnlockPassword = Writer.GetString(); - MetaURL = Writer.GetString(); - BundleURL = Writer.GetString(); + CombinedURL = Writer.GetString(); IsLocalLoad = Writer.GetBool(); Persist = Writer.GetBool(); ModifyScale = Writer.GetBool(); @@ -71,8 +69,7 @@ public void Serialize(NetDataWriter Writer) Writer.Put(Mode); Writer.Put(LoadedNetID); Writer.Put(UnlockPassword); - Writer.Put(MetaURL); - Writer.Put(BundleURL); + Writer.Put(CombinedURL); Writer.Put(IsLocalLoad); Writer.Put(Persist); Writer.Put(ModifyScale); diff --git a/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/BasisServerConfiguration.cs b/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/BasisServerConfiguration.cs index 850f12b4e..48085a7ac 100644 --- a/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/BasisServerConfiguration.cs +++ b/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/BasisServerConfiguration.cs @@ -62,7 +62,7 @@ public static Configuration LoadFromXml(string filePath) return config; } - BNL.LogWarning($"{filePath} not found, creating with default values"); + BNL.Log($"{filePath} not found, creating with default values"); var defaultConfig = new Configuration(); using var writer = new StreamWriter(filePath); diff --git a/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableConfiguration.cs b/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableConfiguration.cs index 11c9c9001..f488d31c1 100644 --- a/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableConfiguration.cs +++ b/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableConfiguration.cs @@ -12,8 +12,7 @@ public class BasisLoadableConfiguration public byte Mode = 0; public string LoadedNetID = ""; public string UnlockPassword = ""; - public string MetaURL = ""; - public string BundleURL = ""; + public string CombinedURL = ""; public bool IsLocalLoad = false; public float PositionX = 0f; diff --git a/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs b/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs index 80a3e4f08..88b6bee72 100644 --- a/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs +++ b/Basis/Packages/com.basis.server/BasisNetworkServer/BasisNetworking/InitalData/BasisLoadableLoader.cs @@ -33,7 +33,7 @@ public static void LoadXML(string FolderName) foreach (BasisLoadableConfiguration config in configurations) { - BNL.Log($"Bundle: {config.BundleURL}, Meta: {config.MetaURL}, LoadAssetPassword: {config.UnlockPassword}"); + BNL.Log($"CombinedURL: {config.CombinedURL}, LoadAssetPassword: {config.UnlockPassword}"); LocalLoadResource LLR = FromBasisLoadableConfiguration(config); BasisNetworkResourceManagement.LoadResource(LLR); @@ -51,8 +51,7 @@ public static LocalLoadResource FromBasisLoadableConfiguration(BasisLoadableConf Mode = config.Mode, LoadedNetID = config.LoadedNetID, UnlockPassword = config.UnlockPassword, - MetaURL = config.MetaURL, - BundleURL = config.BundleURL, + CombinedURL = config.CombinedURL, IsLocalLoad = config.IsLocalLoad, PositionX = config.PositionX, PositionY = config.PositionY, diff --git a/Basis/Packages/com.basis.settingsmanager/SettingsManager/SMInputType/SettingsManagerDynamics.cs b/Basis/Packages/com.basis.settingsmanager/SettingsManager/SMInputType/SettingsManagerDynamics.cs index 173e20aca..19abb7dc9 100644 --- a/Basis/Packages/com.basis.settingsmanager/SettingsManager/SMInputType/SettingsManagerDynamics.cs +++ b/Basis/Packages/com.basis.settingsmanager/SettingsManager/SMInputType/SettingsManagerDynamics.cs @@ -1,14 +1,53 @@ -namespace BattlePhaze.SettingsManager +using UnityEngine; + +namespace BattlePhaze.SettingsManager { public static class SettingsManagerDynamics { public static void DynamicExecution(int OptionIndex, SettingsManager Manager, int CurrentIndex) { + if (Manager == null) + { + Debug.LogError("SettingsManager instance cannot be null."); + return; + } + + if (Manager.Options == null) + { + Debug.LogError("Options list cannot be null."); + return; + } + + if (OptionIndex < 0 || OptionIndex >= Manager.Options.Count) + { + Debug.LogError($"OptionIndex {OptionIndex} is out of range for "); + return; + } + + var option = Manager.Options[OptionIndex]; + if (option == null) + { + Debug.LogError($"Option at index {OptionIndex} is null."); + return; + } + + if (option.SelectableValueList == null) + { + Debug.LogError($"SelectableValueList for option '{option.Name}' is null."); + return; + } + + if (CurrentIndex < 0 || CurrentIndex >= option.SelectableValueList.Count) + { + Debug.LogError($"CurrentIndex {CurrentIndex} is out of range for option '{option.Name}'."); + return; + } + + option.SelectedValue = option.SelectableValueList[CurrentIndex]?.RealValue; - Manager.Options[OptionIndex].SelectedValue = Manager.Options[OptionIndex].SelectableValueList[CurrentIndex].RealValue; SettingsManagerDescriptionSystem.TxtDescriptionSetText(Manager, OptionIndex); SettingsManagerStorageManagement.Save(Manager); - Manager.SendOption(Manager.Options[OptionIndex]); + Manager.SendOption(option); } } -} \ No newline at end of file +} diff --git a/Basis/Packages/com.basis.tests/BasisDisableOnAndroid.cs b/Basis/Packages/com.basis.tests/BasisDisableOnAndroid.cs new file mode 100644 index 000000000..726da9efb --- /dev/null +++ b/Basis/Packages/com.basis.tests/BasisDisableOnAndroid.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +public class BasisDisableOnAndroid : MonoBehaviour +{ + public GameObject DisableMe; + public void OnEnable() + { + if (Application.platform == RuntimePlatform.Android) + { + GameObject.Destroy(DisableMe.gameObject); + } + } +} diff --git a/Basis/Packages/com.basis.tests/BasisDisableOnAndroid.cs.meta b/Basis/Packages/com.basis.tests/BasisDisableOnAndroid.cs.meta new file mode 100644 index 000000000..82b23b672 --- /dev/null +++ b/Basis/Packages/com.basis.tests/BasisDisableOnAndroid.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 504ccfc32d0f2ae4c9be38cc1a9b15b5 \ No newline at end of file diff --git a/Basis/Packages/com.basis.tests/BasisTestNetworkScene.cs b/Basis/Packages/com.basis.tests/BasisTestNetworkScene.cs index 4641c07b8..e4abf6241 100644 --- a/Basis/Packages/com.basis.tests/BasisTestNetworkScene.cs +++ b/Basis/Packages/com.basis.tests/BasisTestNetworkScene.cs @@ -19,15 +19,12 @@ public class BasisTestNetworkScene : MonoBehaviour public bool IsPersistent; public string ScenePassword = "Scene"; public string SceneMetaUrl = "https://BasisFramework.b-cdn.net/Worlds/DX11/3dd6aa45-a685-4ed2-ba6d-2d9c2f3c1765_638652274774362697.BasisEncyptedMeta"; - public string SceneBundleUrl = "https://BasisFramework.b-cdn.net/Worlds/DX11/3dd6aa45-a685-4ed2-ba6d-2d9c2f3c1765_638652274774362697.BasisEncyptedBundle"; public string GameobjectPassword = "862eb77aa76d193284a806f040deb6c6b9d4866bef63f7c829237d524fb979d2"; public string GameobjectMetaUrl = "https://BasisFramework.b-cdn.net/Props/DX11/NetworkedTestPickup/ec0fdd4d-9eb2-467c-9b52-40f05932f859_638736352879974628.BasisEncyptedMeta"; - public string GameobjectBundleUrl = "https://BasisFramework.b-cdn.net/Props/DX11/NetworkedTestPickup/ec0fdd4d-9eb2-467c-9b52-40f05932f859_638736352879974628.BasisEncyptedBundle"; public string PropPassword = "28d6240548cae8229e169777686b4b967ca23b924abb96565823206989795215"; public string PropMetaUrl = "https://BasisFramework.b-cdn.net/Props/DX11/90516234-6412-4a1e-a45f-c3f8dfbd7071_638735227126189132.BasisEncyptedMeta"; - public string PropBundleUrl = "https://BasisFramework.b-cdn.net/Props/DX11/90516234-6412-4a1e-a45f-c3f8dfbd7071_638735227126189132.BasisEncyptedBundle"; public bool OverrideSpawnPosition; public Vector3 Position; public bool ModifyScale = false; @@ -49,21 +46,18 @@ public void OnEnable() if (SceneLoadTest) { BasisNetworkSpawnItem.RequestSceneLoad(ScenePassword, - SceneBundleUrl, SceneMetaUrl, false, IsPersistent, out Scene); } if (GameobjectLoadTest) { BasisNetworkSpawnItem.RequestGameObjectLoad(GameobjectPassword, - GameobjectBundleUrl, GameobjectMetaUrl, false, Position, Quaternion.identity, Vector3.one, IsPersistent, ModifyScale, out Gameobject); } if (PropLoadTest) { BasisNetworkSpawnItem.RequestGameObjectLoad(PropPassword, - PropBundleUrl, PropMetaUrl, false, Position, Quaternion.identity, Vector3.one, IsPersistent, ModifyScale, out Gameobject); } diff --git a/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigFixedUpdateHandler.cs b/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigFixedUpdateHandler.cs index fba5cfffd..9c947cab2 100644 --- a/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigFixedUpdateHandler.cs +++ b/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigFixedUpdateHandler.cs @@ -21,4 +21,4 @@ private void FixedUpdate() } } } -} \ No newline at end of file +} diff --git a/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigHandler.cs b/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigHandler.cs index 0de1f68c0..22cf9c9da 100644 --- a/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigHandler.cs +++ b/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigHandler.cs @@ -8,7 +8,7 @@ internal class JiggleRigHandler : MonoBehaviour where T : MonoBehaviour { private static T instance; - protected static List jiggleRigs = new(); + protected static List jiggleRigs = new List(); protected static IJiggleAdvancable[] jiggleRigsArray; protected static int JiggleRigCount; private static void CreateInstanceIfNeeded() @@ -17,7 +17,7 @@ private static void CreateInstanceIfNeeded() { return; } - + jiggleRigs.Clear(); GameObject obj = new GameObject("JiggleRigHandler", typeof(T)) { hideFlags = HideFlags.DontSave @@ -43,13 +43,6 @@ private static void RemoveInstanceIfNeeded() } instance = null; } - - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] - private static void Initialize() - { - jiggleRigs.Clear(); - } - internal static void AddJiggleRigAdvancable(IJiggleAdvancable advancable) { CreateInstanceIfNeeded(); @@ -83,5 +76,4 @@ private void OnDestroy() } } } - -} \ No newline at end of file +} diff --git a/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigLateUpdateHandler.cs b/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigLateUpdateHandler.cs index a1b355575..14237c66b 100644 --- a/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigLateUpdateHandler.cs +++ b/Basis/Packages/com.naelstrof.jigglephysics/Scripts/JiggleRigLateUpdateHandler.cs @@ -29,4 +29,4 @@ private void LateUpdate() } } -} \ No newline at end of file +} diff --git a/Basis/ProjectSettings/AudioManager.asset b/Basis/ProjectSettings/AudioManager.asset index 65c5179d9..e604e6fdb 100644 --- a/Basis/ProjectSettings/AudioManager.asset +++ b/Basis/ProjectSettings/AudioManager.asset @@ -10,7 +10,7 @@ AudioManager: Default Speaker Mode: 2 m_SampleRate: 0 m_DSPBufferSize: 1024 - m_VirtualVoiceCount: 1024 + m_VirtualVoiceCount: 512 m_RealVoiceCount: 100 m_EnableOutputSuspension: 1 m_SpatializerPlugin: Steam Audio Spatializer diff --git a/Basis/ProjectSettings/ProjectSettings.asset b/Basis/ProjectSettings/ProjectSettings.asset index b5d219b1d..a813c2d1b 100644 --- a/Basis/ProjectSettings/ProjectSettings.asset +++ b/Basis/ProjectSettings/ProjectSettings.asset @@ -174,7 +174,7 @@ PlayerSettings: iPhone: 0 tvOS: 0 overrideDefaultApplicationIdentifier: 0 - AndroidBundleVersionCode: 2 + AndroidBundleVersionCode: 10 AndroidMinSdkVersion: 32 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 0 @@ -405,7 +405,7 @@ PlayerSettings: m_BuildTargetGraphicsJobMode: [] m_BuildTargetGraphicsAPIs: - m_BuildTarget: WindowsStandaloneSupport - m_APIs: 12000000 + m_APIs: 02000000 m_Automatic: 0 - m_BuildTarget: MacStandaloneSupport m_APIs: 10000000 @@ -712,7 +712,7 @@ PlayerSettings: PS4: QNX: Server: - Standalone: SETTINGS_MANAGER_UNIVERSAL;STEAMAUDIO_ENABLED;USE_INPUT_SYSTEM_POSE_CONTROL;USE_STICK_CONTROL_THUMBSTICKS;BASIS_OPENVR_SUPPORTED;AUDIOLINK;AUDIOLINK_V1 + Standalone: STEAMAUDIO_ENABLED;USE_INPUT_SYSTEM_POSE_CONTROL;USE_STICK_CONTROL_THUMBSTICKS;BASIS_OPENVR_SUPPORTED;AUDIOLINK;AUDIOLINK_V1;SETTINGS_MANAGER_UNIVERSAL WebGL: STEAMAUDIO_ENABLED Windows Store Apps: USE_INPUT_SYSTEM_POSE_CONTROL;USE_STICK_CONTROL_THUMBSTICKS XboxOne: diff --git a/Basis/ProjectSettings/QualitySettings.asset b/Basis/ProjectSettings/QualitySettings.asset index e4247d78d..61ef6ba9f 100644 --- a/Basis/ProjectSettings/QualitySettings.asset +++ b/Basis/ProjectSettings/QualitySettings.asset @@ -75,7 +75,7 @@ QualitySettings: globalTextureMipmapLimit: 0 textureMipmapLimitSettings: [] anisotropicTextures: 1 - antiAliasing: 4 + antiAliasing: 2 softParticles: 1 softVegetation: 1 realtimeReflectionProbes: 1