Class PolySpatialObjectUtils
Utility methods for working with PolySpatial objects.
Inherited Members
Namespace: Unity.PolySpatial
Assembly: Unity.PolySpatial.dll
Syntax
public static class PolySpatialObjectUtils
Methods
GetGameObjectForPolySpatialIdentifier(ulong)
Return the GameObject corresponding to the given identifier, if any.
Declaration
public static GameObject GetGameObjectForPolySpatialIdentifier(ulong id)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | id | The PolySpatial identifier to get the GameObject for. |
Returns
| Type | Description |
|---|---|
| GameObject | The GameObject, or null. |
GetPolySpatialIdentifier(GameObject)
Return an identifier usable by PolySpatial backends to obtain platform-specific resources.
Declaration
public static ulong GetPolySpatialIdentifier(GameObject go)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | go | The GameObject to get the identifier for. |
Returns
| Type | Description |
|---|---|
| ulong | The identifier for the object. |
MarkDirty(AudioSource)
Marks the specified AudioSource as dirty so that it will be updated over PolySpatial.
Declaration
public static void MarkDirty(AudioSource audioSource)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioSource | audioSource | The audio source to mark as dirty. |
MarkDirty(UIBehaviour)
Marks the specified UIBehaviour as dirty so that it will be updated over PolySpatial.
Declaration
public static void MarkDirty(UIBehaviour behaviour)
Parameters
| Type | Name | Description |
|---|---|---|
| UIBehaviour | behaviour | The behaviour to mark as dirty. |
MarkDirty(Material)
Marks the specified material as changed so that it will be updated over PolySpatial.
Declaration
public static void MarkDirty(Material material)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | material | The material to mark as changed. |
MarkDirty(Renderer)
Marks the specified renderer as changed so that it will be updated over PolySpatial.
Declaration
public static void MarkDirty(Renderer renderer)
Parameters
| Type | Name | Description |
|---|---|---|
| Renderer | renderer | The renderer to mark as changed. |
MarkDirty(Texture)
Marks the whole of the specified texture as changed so that it will be updated over PolySpatial.
This states what changed, not what is transferred. Where region detection is enabled, the actual transfer may be narrowed to the parts that differ; the host ends up with the same contents either way, so detection neither weakens nor redefines a whole mark. Use MarkDirty(Texture, RectInt) to state that only a region changed.
Declaration
public static void MarkDirty(Texture texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture | The texture to mark as changed. |
MarkDirty(Texture, RectInt)
Marks only a rectangular sub-region of the specified texture as changed -- the narrower statement than MarkDirty(Texture) -- so that, when supported by the connected host, only that region (rather than the whole texture) is transferred over PolySpatial. The region is in mip-0 pixel coordinates. Multiple calls within a frame accumulate; the accumulated regions are drained when the texture is next sent. The texture is also marked dirty as a whole so that it enters the change list either way.
For a mipmapped Texture2D the corresponding sub-region of every mip level is sent along
with mip 0, read from the texture's current contents -- so regenerate the mip chain (for example
Apply(updateMipmaps: true)) before marking the region.
Whether the recorded regions are actually used for a partial transfer is decided by the sender's negotiated-capability gate; if partial texture updates are not negotiated, this is equivalent to MarkDirty(Texture) and the region is ignored (the store is drained and discarded when the texture is next sent).
Declaration
public static void MarkDirty(Texture texture, RectInt region)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture | The texture to mark as changed. |
| RectInt | region | The changed sub-region, in mip-0 pixel coordinates. |
MarkFinal(Cubemap)
Marks the specified texture as "final," meaning that its contents will never be changed. This allows PolySpatial to unload Unity's copy of the texture after transferring it, reducing the total amount of memory used. Note that the texture will not be readable after being transferred.
Declaration
public static void MarkFinal(Cubemap texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Cubemap | texture | The texture to mark as final. |
MarkFinal(Mesh)
Marks the specified mesh as "final," meaning that its contents will never be changed. This allows PolySpatial to unload Unity's copy of the mesh after transferring it, reducing the total amount of memory used. Note that the mesh will not be readable after being transferred (it will be replaced with empty placeholder data).
Declaration
public static void MarkFinal(Mesh mesh)
Parameters
| Type | Name | Description |
|---|---|---|
| Mesh | mesh | The mesh to mark as final. |
MarkFinal(Texture2D)
Marks the specified texture as "final," meaning that its contents will never be changed. This allows PolySpatial to unload Unity's copy of the texture after transferring it, reducing the total amount of memory used. Note that the texture will not be readable after being transferred.
Declaration
public static void MarkFinal(Texture2D texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | texture | The texture to mark as final. |
MarkFinal(Texture3D)
Marks the specified texture as "final," meaning that its contents will never be changed. This allows PolySpatial to unload Unity's copy of the texture after transferring it, reducing the total amount of memory used. Note that the texture will not be readable after being transferred.
Declaration
public static void MarkFinal(Texture3D texture)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture3D | texture | The texture to mark as final. |
MarkUniversalCameraDataDirty(Camera)
Attempt to mark the UniversalAdditionalCameraData component dirty so that it will be updated over PolySpatial - if it doesn't exist or if UniversalRenderPipeline (URP) is disabled, this function does nothing.
Declaration
public static void MarkUniversalCameraDataDirty(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The URP camera to mark dirty. Note that this function does not dirty the camera itself, but the UniversalAdditionalCameraData component attached to the camera. |
PauseAudioSource(AudioSource)
Pauses a specified AudioSource and then mark it as changed so that it will be updated over PolySpatial.
Declaration
public static void PauseAudioSource(AudioSource audioSource)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioSource | audioSource | The audioSource to pause and mark as changed. |
PlayAudioSource(AudioSource)
Plays a specified AudioSource and then mark it as changed so that it will be updated over PolySpatial.
Declaration
public static void PlayAudioSource(AudioSource audioSource)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioSource | audioSource | The audioSource to play and mark as changed. |
SetStreaming(Texture, bool)
Sets or clears a texture's streaming flag, where streaming means that we expect it to change frequently. This acts as a hint to PolySpatial that it should treat it as it would a RenderTexture, which is useful when the texture comes from an external source.
Declaration
public static void SetStreaming(Texture texture, bool streaming = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture | The texture whose streaming flag should be set or cleared. |
| bool | streaming | Whether to set or clear the streaming flag. |
StopAudioSource(AudioSource)
Stops a specified AudioSource and then mark it as changed so that it will be updated over PolySpatial.
Declaration
public static void StopAudioSource(AudioSource audioSource)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioSource | audioSource | The audioSource to stop and mark as changed. |
UnPauseAudioSource(AudioSource)
UnPauses a specified AudioSource and then mark it as changed so that it will be updated over PolySpatial.
Declaration
public static void UnPauseAudioSource(AudioSource audioSource)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioSource | audioSource | The audioSource to unpause and mark as changed. |