From 8338933e925a9023920ec813ac96824a80d474a4 Mon Sep 17 00:00:00 2001 From: SamuelGuizani <152900554+SamuelGuizani@users.noreply.github.com> Date: Mon, 24 Nov 2025 11:25:06 +0100 Subject: [PATCH] Add fallback return false for passthrough methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a missing fallback return false; to the passthrough methods. A function must always guarantee a return value that matches its signature, even when the code path seems obvious. Without that, the compiler complains. This change ensures the method now consistently returns a valid boolean in all cases. (A small reminder that one of the most fundamental rules in programming is: if a function says it returns something… it should actually return something đŸ˜‰) --- .../Scripts/CompositionLayerPassthroughAPI.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/com.htc.upm.vive.openxr/Runtime/CompositionLayer/Scripts/CompositionLayerPassthroughAPI.cs b/com.htc.upm.vive.openxr/Runtime/CompositionLayer/Scripts/CompositionLayerPassthroughAPI.cs index 91ba06a..2d1c202 100644 --- a/com.htc.upm.vive.openxr/Runtime/CompositionLayer/Scripts/CompositionLayerPassthroughAPI.cs +++ b/com.htc.upm.vive.openxr/Runtime/CompositionLayer/Scripts/CompositionLayerPassthroughAPI.cs @@ -416,6 +416,7 @@ public static bool DestroyPassthrough(int passthroughID) #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_DestroyPassthrough(passthroughID); #endif + return false; } /// @@ -474,6 +475,7 @@ public static bool SetPassthroughAlpha(int passthroughID, float alpha, bool auto else return false; #endif + return false; } /// @@ -545,6 +547,7 @@ public static bool SetProjectedPassthroughMesh(int passthroughID, [In, Out] Vect #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetMesh(passthroughID, (uint)vertexBuffer.Length, vertexBufferXrVector, (uint)indexBuffer.Length, indexBufferUint); ; #endif + return false; } /// @@ -623,6 +626,7 @@ public static bool SetProjectedPassthroughMeshTransform(int passthroughID, Proje #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetMeshTransform(passthroughID, passthroughFeature.GetXrSpaceFromSpaceType(spaceType), meshXrPose, meshXrScale); #endif + return false; } /// @@ -661,7 +665,7 @@ public static bool SetPassthroughLayerType(int passthroughID, LayerType layerTyp #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetLayerType(passthroughID, layerType, compositionDepth); #endif - + return false; } /// @@ -702,6 +706,7 @@ public static bool SetProjectedPassthroughSpaceType(int passthroughID, Projected #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetMeshTransformSpace(passthroughID, passthroughFeature.GetXrSpaceFromSpaceType(spaceType)); #endif + return false; } /// @@ -764,6 +769,7 @@ public static bool SetProjectedPassthroughMeshPosition(int passthroughID, Vector #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetMeshTransformPosition(passthroughID, OpenXRHelper.ToOpenXRVector(trackingSpaceMeshPosition, convertFromUnityToOpenXR)); #endif + return false; } /// @@ -826,6 +832,7 @@ public static bool SetProjectedPassthroughMeshOrientation(int passthroughID, Qua #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetMeshTransformOrientation(passthroughID, OpenXRHelper.ToOpenXRQuaternion(trackingSpaceMeshRotation, convertFromUnityToOpenXR)); #endif + return false; } /// @@ -867,6 +874,7 @@ public static bool SetProjectedPassthroughScale(int passthroughID, Vector3 meshS #if UNITY_ANDROID return passthroughFeature.HTCPassthrough_SetMeshTransformScale(passthroughID, OpenXRHelper.ToOpenXRVector(meshScale, false)); #endif + return false; } /// @@ -887,4 +895,4 @@ public static List GetCurrentPassthroughLayerIDs() } #endregion } -} \ No newline at end of file +}