GetExposedSpace
Provides the configured space of an exposed property in VisualEffectAsset.
Read time 2 minutesLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEngine.VFX
- Assembly: UnityEngine.VFXModule
GetExposedSpace(int)
Provides the configured space of an exposed property in VisualEffectAsset.
public VFXSpace GetExposedSpace(int nameID)
Parameters
The ID of the property. This is the same ID that Shader.PropertyToID returns.
Returns
Type | Description |
|---|---|
| VFXSpace | The expected space of the property. |
Remarks
VFXSpace.None will be returned if the property doesn't exist or isn't spaceable.
The VisualEffect.SetVector3 won't apply any automatic transform, because expects raw values.
VisualEffectThis example logs detailed information regarding all exposed properties.
Additional Resources: VisualEffectAsset.GetExposedProperties, VisualEffectAsset.GetExposedSpace, VisualEffectAsset.GetTextureDimension
Examples
using System.Collections.Generic;using UnityEngine;using UnityEngine.Rendering;using UnityEngine.VFX;[ExecuteInEditMode]class LogExposedProperties : MonoBehaviour{ // Called when the script or GameObject is enabled void OnEnable() { VisualEffect vfx = GetComponent<VisualEffect>(); if (vfx != null && vfx.visualEffectAsset != null) { VisualEffectAsset vfxAsset = vfx.visualEffectAsset; var exposedProperties = new List<VFXExposedProperty>(); // Retrieve all exposed properties from the VisualEffectAsset and store them in the list vfxAsset.GetExposedProperties(exposedProperties); if (exposedProperties.Count == 0) { Debug.Log($"There are no exposed properties for asset: {vfxAsset}"); } foreach (var exposedProperty in exposedProperties) { // Retrieve additional details about the exposed property VFXSpace space = vfxAsset.GetExposedSpace(exposedProperty.name); TextureDimension texDim = vfxAsset.GetTextureDimension(exposedProperty.name); string log = $"{exposedProperty.name}, {exposedProperty.type}"; if (space != VFXSpace.None) { log += $", {space}"; } if (texDim != TextureDimension.Unknown) { log += $", {texDim}"; } Debug.Log(log); } } else { Debug.Log("Unable to retrieve VisualEffect component or VisualEffectAsset is null."); } }}
GetExposedSpace(string)
Provides the configured space of an exposed property in VisualEffectAsset.
public VFXSpace GetExposedSpace(string name)
Parameters
The name of the property.
Returns
Type | Description |
|---|---|
| VFXSpace | The expected space of the property. |
Remarks
VFXSpace.None will be returned if the property doesn't exist or isn't spaceable.
The VisualEffect.SetVector3 won't apply any automatic transform, because expects raw values.
VisualEffectThis example logs detailed information regarding all exposed properties.
Additional Resources: VisualEffectAsset.GetExposedProperties, VisualEffectAsset.GetExposedSpace, VisualEffectAsset.GetTextureDimension
Examples
using System.Collections.Generic;using UnityEngine;using UnityEngine.Rendering;using UnityEngine.VFX;[ExecuteInEditMode]class LogExposedProperties : MonoBehaviour{ // Called when the script or GameObject is enabled void OnEnable() { VisualEffect vfx = GetComponent<VisualEffect>(); if (vfx != null && vfx.visualEffectAsset != null) { VisualEffectAsset vfxAsset = vfx.visualEffectAsset; var exposedProperties = new List<VFXExposedProperty>(); // Retrieve all exposed properties from the VisualEffectAsset and store them in the list vfxAsset.GetExposedProperties(exposedProperties); if (exposedProperties.Count == 0) { Debug.Log($"There are no exposed properties for asset: {vfxAsset}"); } foreach (var exposedProperty in exposedProperties) { // Retrieve additional details about the exposed property VFXSpace space = vfxAsset.GetExposedSpace(exposedProperty.name); TextureDimension texDim = vfxAsset.GetTextureDimension(exposedProperty.name); string log = $"{exposedProperty.name}, {exposedProperty.type}"; if (space != VFXSpace.None) { log += $", {space}"; } if (texDim != TextureDimension.Unknown) { log += $", {texDim}"; } Debug.Log(log); } } else { Debug.Log("Unable to retrieve VisualEffect component or VisualEffectAsset is null."); } }}