Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

PlayerSettings.GetRayTracingFeaturesSupportForPlatform

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Declaration

public static RayTracingFeatureFlags GetRayTracingFeaturesSupportForPlatform(BuildTarget platform, bool checkGraphicsApisList);

Parameters

Parameter Description
platform The target platform to check. Use UnityEditor.EditorUserBuildSettings.activeBuildTarget to specify the current Build target.
checkGraphicsApisList Set to true to check the graphics API list in the Player settings.

Returns

RayTracingFeatureFlags A list of flags that represent ray tracing features that the target platform supports.

Description

Gets the ray tracing features that the specified target platform supports.

If checkGraphicsApisList is true, this method checks the graphics API list configured in the Player settings for the given platform. If none of the graphics APIs support a specific ray tracing feature, no flags are returned.

Additional resources: RayTracingFeatureFlags.

using UnityEngine;
using UnityEditor;

public class CheckRayTracingFeatures : MonoBehaviour { void Start() { BuildTarget buildTarget = UnityEditor.EditorUserBuildSettings.activeBuildTarget;

RayTracingFeatureFlags features = PlayerSettings.GetRayTracingFeaturesSupportForPlatform(buildTarget, true);

Debug.Log("Checking target platform " + buildTarget + " for ray tracing features.");

if (features == RayTracingFeatureFlags.None) { Debug.Log("The target platform doesn't support any ray tracing features."); } else { if ((features & RayTracingFeatureFlags.InlineRayTracing) != 0) Debug.Log("The target platform supports Inline Ray Tracing.");

if ((features & RayTracingFeatureFlags.RayTracingShaders) != 0) Debug.Log("The target platform supports Ray Tracing Shaders."); } } }

The example above checks and reports any ray tracing features supported by the active build target platform.