Class UsdVariantSet
Represents one or more USD variant sets. This object holds slection state and exposes access to the current selection as well as an API to apply selection changes (used by the editor).
Inherited Members
Namespace: Unity.Formats.USD
Syntax
public class UsdVariantSet : MonoBehaviour
Remarks
Note that a singe asset can have multiple variant sets and each is independent. For example, the modelingVariant set may have two variants: CupWithHandle and CupWithoutHandle, while the shadingVariant set may have three variants: Red, Green, Blue. The full outer product of all variant selections is possible, e.g. Red, Green, or Blue CupWithHandle and Red, Green, or Blue CupWithoutHandle.
For more details on USD variant sets and selections, see: https://graphics.pixar.com/usd/docs/USD-Glossary.html#USDGlossary-VariantSet
Fields
m_primPath
Declaration
public string m_primPath
Field Value
Type | Description |
---|---|
String |
m_selected
Declaration
public string[] m_selected
Field Value
Type | Description |
---|---|
String[] |
m_variantCounts
Declaration
public int[] m_variantCounts
Field Value
Type | Description |
---|---|
Int32[] |
m_variants
Declaration
public string[] m_variants
Field Value
Type | Description |
---|---|
String[] |
m_variantSetNames
Declaration
public string[] m_variantSetNames
Field Value
Type | Description |
---|---|
String[] |
Methods
ApplyVariantSelections()
Syncs the current Unity state to USD and reimports any affected GameObjects. Note that this may result in the objects being destroyed and recreated.
Declaration
public void ApplyVariantSelections()
GetVariantSelections()
Returns a collection of VariantSetName -> ActiveVariantSelectionName, which represents the active variant selection at the prim associated with this behaviour.
Declaration
public Dictionary<string, string> GetVariantSelections()
Returns
Type | Description |
---|---|
Dictionary<String, String> |
Examples
If two sets with selections are modelingVariant=CupWithHandle and shadingVariant=BrightBlue, resulting in a bright blue cup with a handle. In this example, the selections dictionary would contain: { "modelingVariant" = "CupWithHandle", "shadingVariant" = "BrightBlue" }
LoadFromUsd(UsdPrim)
Loads the variant sets and selection state from USD into the UsdVariantSet behaviour.
Declaration
public void LoadFromUsd(UsdPrim prim)
Parameters
Type | Name | Description |
---|---|---|
UsdPrim | prim |