Stay organized with collections
Save and categorize content based on your preferences.
ARSemanticManager
Provides access to the Scene Semantics API.
Summary
Inheritance
Inherits from:
UnityEngine::MonoBehaviour
Public functions
GetSemanticLabelFraction
float GetSemanticLabelFraction(
SemanticLabel queryLabel
)
Retrieves the percentage of pixels in the most recent semantics image that are queryLabel
.
This call is more efficient than retrieving the image and performing a pixel-wise search for the detected label.
Details |
Parameters |
queryLabel
|
The SemanticLabel to search for within the semantic image for this frame.
|
|
Returns
|
The fraction of pixels in the most recent semantic image that contains the query label. This value is in the range 0.0 to 1.0. If no pixels are present with that label, or if an invalid label is provided, this call returns 0.0.
|
IsSemanticModeSupported
FeatureSupported IsSemanticModeSupported(
SemanticMode mode
)
Checks whether the provided SemanticMode
is supported on this device with the selected camera configuration.
The current list of supported devices is documented on the ARCore supported devices page.
Details |
Parameters |
mode
|
The desired semantic mode.
|
|
Returns
|
Indicates whether the given mode is supported on this device. It will return FeatureSupported.Unknown if the session is still under initialization.
|
TryGetSemanticConfidenceTexture
bool TryGetSemanticConfidenceTexture(
ref Texture2D texture
)
Attempts to get a texture representing the semantic confidence image corresponding to the current frame.
The texture format is TextureFormat.Alpha8
, with each pixel representing the estimated confidence of the corresponding pixel in the semantic image. See the Scene Semantics Developer Guide for more information.
The confidence value is between 0 and 255, inclusive, with 0 representing the lowest confidence and 255 representing the highest confidence in the semantic class prediction.
In order to obtain a valid result from this function, you must set the session's SemanticMode
to SemanticMode.Enabled
. Use ARSemanticManager.IsSemanticModeSupported(SemanticMode)
to query for support for Scene Semantics.
The size of the semantic confidence image is the same size as the image obtained by ARSemanticManager.TryGetSemanticTexture(ref Texture2D)
.
Details |
Parameters |
texture
|
The semantic confidence image Texture2D to be filled.
|
|
Returns
|
True if the semantic confidence image texture was filled. Otherwise, false.
|
TryGetSemanticTexture
bool TryGetSemanticTexture(
ref Texture2D texture
)
Attempts to get a texture representing the semantic image for the current frame.
The texture format is TextureFormat.R8
. Each pixel in the image is an 8-bit unsigned integer representing a semantic class label. SemanticLabel
is the list of possible pixel labels. See the Scene Semantics Developer Guide for more information.
In order to obtain a valid result from this function, you must set the session's SemanticMode
to SemanticMode.Enabled
. Use ARSemanticManager.IsSemanticModeSupported(SemanticMode)
to query for support for Scene Semantics.
The width of the semantic image is currently 256 pixels. The height of the image depends on the device and will match its display aspect ratio.
Details |
Parameters |
texture
|
The semantic image Texture2D to be filled.
|
|
Returns
|
True if the semantic image texture was filled. Otherwise, false.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[null,null,["Last updated 2025-07-14 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eARSemanticManager\u003c/code\u003e provides access to the Scene Semantics API, allowing developers to interact with and understand the environment in real-time.\u003c/p\u003e\n"],["\u003cp\u003eIt offers functionalities to retrieve the percentage of pixels representing specific semantic labels, check device support for semantic modes, and obtain textures representing the semantic and semantic confidence images.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use the semantic information to enhance AR experiences by enabling interactions with real-world objects based on their semantic understanding, such as identifying walls, floors, or furniture.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize the Scene Semantics API, the session's \u003ccode\u003eSemanticMode\u003c/code\u003e should be enabled, and device compatibility can be verified using the \u003ccode\u003eIsSemanticModeSupported\u003c/code\u003e function.\u003c/p\u003e\n"]]],[],null,["# ARSemanticManager Class Reference\n\nARSemanticManager\n=================\n\nProvides access to the Scene Semantics API.\n\nSummary\n-------\n\n### Inheritance\n\nInherits from: [`UnityEngine::MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html)\n\n| ### Public functions ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [GetSemanticLabelFraction](#getsemanticlabelfraction)`(`[SemanticLabel](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticlabel)` queryLabel)` | `float` Retrieves the percentage of pixels in the most recent semantics image that are `queryLabel`. |\n| [IsSemanticModeSupported](#issemanticmodesupported)`(`[SemanticMode](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticmode)` mode)` | [FeatureSupported](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#featuresupported) Checks whether the provided [SemanticMode](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticmode) is supported on this device with the selected camera configuration. |\n| [TryGetSemanticConfidenceTexture](#trygetsemanticconfidencetexture)`(ref `[Texture2D](https://docs.unity3d.com/ScriptReference/Texture2D.html)` texture)` | `bool` Attempts to get a texture representing the semantic confidence image corresponding to the current frame. |\n| [TryGetSemanticTexture](#trygetsemantictexture)`(ref `[Texture2D](https://docs.unity3d.com/ScriptReference/Texture2D.html)` texture)` | `bool` Attempts to get a texture representing the semantic image for the current frame. |\n\nPublic functions\n----------------\n\n### GetSemanticLabelFraction\n\n```c#\nfloat GetSemanticLabelFraction(\n SemanticLabel queryLabel\n)\n``` \nRetrieves the percentage of pixels in the most recent semantics image that are `queryLabel`.\n\nThis call is more efficient than retrieving the image and performing a pixel-wise search for the detected label.\n\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| | `queryLabel` | The [SemanticLabel](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticlabel) to search for within the semantic image for this frame. | |\n| **Returns** | The fraction of pixels in the most recent semantic image that contains the query label. This value is in the range 0.0 to 1.0. If no pixels are present with that label, or if an invalid label is provided, this call returns 0.0. |\n\n### IsSemanticModeSupported\n\n```c#\nFeatureSupported IsSemanticModeSupported(\n SemanticMode mode\n)\n``` \nChecks whether the provided [SemanticMode](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticmode) is supported on this device with the selected camera configuration.\n\nThe current list of supported devices is documented on the [ARCore supported devices](https://developers.google.com/ar/devices) page.\n\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |--------|----------------------------| | `mode` | The desired semantic mode. | |\n| **Returns** | Indicates whether the given mode is supported on this device. It will return `FeatureSupported.Unknown` if the session is still under initialization. |\n\n### TryGetSemanticConfidenceTexture\n\n```c#\nbool TryGetSemanticConfidenceTexture(\n ref Texture2D texture\n)\n``` \nAttempts to get a texture representing the semantic confidence image corresponding to the current frame.\n\nThe texture format is `TextureFormat.Alpha8`, with each pixel representing the estimated confidence of the corresponding pixel in the semantic image. See the [Scene Semantics Developer Guide](https://developers.google.com/ar/develop/unity-arf/scene-semantics) for more information.\n\nThe confidence value is between 0 and 255, inclusive, with 0 representing the lowest confidence and 255 representing the highest confidence in the semantic class prediction.\n\nIn order to obtain a valid result from this function, you must set the session's [SemanticMode](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticmode) to `SemanticMode.Enabled`. Use [ARSemanticManager.IsSemanticModeSupported(SemanticMode)](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARSemanticManager#issemanticmodesupported) to query for support for Scene Semantics.\n\nThe size of the semantic confidence image is the same size as the image obtained by [ARSemanticManager.TryGetSemanticTexture(ref Texture2D)](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARSemanticManager#trygetsemantictexture).\n\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |-----------|---------------------------------------------------------| | `texture` | The semantic confidence image `Texture2D` to be filled. | |\n| **Returns** | True if the semantic confidence image texture was filled. Otherwise, false. |\n\n### TryGetSemanticTexture\n\n```c#\nbool TryGetSemanticTexture(\n ref Texture2D texture\n)\n``` \nAttempts to get a texture representing the semantic image for the current frame.\n\nThe texture format is `TextureFormat.R8`. Each pixel in the image is an 8-bit unsigned integer representing a semantic class label. [SemanticLabel](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticlabel) is the list of possible pixel labels. See the [Scene Semantics Developer Guide](https://developers.google.com/ar/develop/unity-arf/scene-semantics) for more information.\n\nIn order to obtain a valid result from this function, you must set the session's [SemanticMode](/ar/reference/unity-arf/namespace/Google/XR/ARCoreExtensions#semanticmode) to `SemanticMode.Enabled`. Use [ARSemanticManager.IsSemanticModeSupported(SemanticMode)](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARSemanticManager#issemanticmodesupported) to query for support for Scene Semantics.\n\nThe width of the semantic image is currently 256 pixels. The height of the image depends on the device and will match its display aspect ratio.\n\n\n| Details ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |-----------|----------------------------------------------| | `texture` | The semantic image `Texture2D` to be filled. | |\n| **Returns** | True if the semantic image texture was filled. Otherwise, false. |"]]