Class UsdAsset | USD | 2.0.0-exp.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class UsdAsset

    Represents the point at which a UsdStage has been imported into the Unity scene. The goal is to make it easy to re-import the data and to export sparse overrides.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    UsdAsset
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: Unity.Formats.USD
    Syntax
    [ExecuteInEditMode]
    public class UsdAsset : MonoBehaviour

    Fields

    LastHandedness

    Declaration
    [HideInInspector]
    public BasisTransformation LastHandedness
    Field Value
    Type Description
    BasisTransformation

    LastScale

    Declaration
    [HideInInspector]
    public float LastScale
    Field Value
    Type Description
    Single

    m_boundingBox

    Declaration
    public ImportMode m_boundingBox
    Field Value
    Type Description
    ImportMode

    m_changeHandedness

    Declaration
    [Tooltip("Conversion method for right-handed (USD) to left-handed conversion (Unity) and vice versa.")]
    public BasisTransformation m_changeHandedness
    Field Value
    Type Description
    BasisTransformation

    m_color

    Declaration
    [Tooltip("Combined import policy for primvars:displayColor and primvars:displayOpacity")]
    public ImportMode m_color
    Field Value
    Type Description
    ImportMode

    m_debugPrintVariabilityCache

    Declaration
    public bool m_debugPrintVariabilityCache
    Field Value
    Type Description
    Boolean

    m_debugShowSkeletonBindPose

    Declaration
    [Header("Debug Options")]
    public bool m_debugShowSkeletonBindPose
    Field Value
    Type Description
    Boolean

    m_debugShowSkeletonRestPose

    Declaration
    public bool m_debugShowSkeletonRestPose
    Field Value
    Type Description
    Boolean

    m_displayColorMaterial

    Declaration
    [Tooltip("The default material to use when importing materials as display color.")]
    public Material m_displayColorMaterial
    Field Value
    Type Description
    Material

    m_enableGpuInstancing

    Declaration
    [HideInInspector]
    [Tooltip("When enabled, set the GPU Instancing flag on all materials.")]
    public bool m_enableGpuInstancing
    Field Value
    Type Description
    Boolean

    m_generateLightmapUVs

    Declaration
    [Header("Mesh Lightmap UV Unwrapping")]
    public bool m_generateLightmapUVs
    Field Value
    Type Description
    Boolean

    m_importCameras

    Declaration
    public bool m_importCameras
    Field Value
    Type Description
    Boolean

    m_importHierarchy

    Declaration
    [HideInInspector]
    public bool m_importHierarchy
    Field Value
    Type Description
    Boolean

    m_importMeshes

    Declaration
    public bool m_importMeshes
    Field Value
    Type Description
    Boolean

    m_importMonoBehaviors

    Declaration
    public bool m_importMonoBehaviors
    Field Value
    Type Description
    Boolean

    m_importPointInstances

    Declaration
    public bool m_importPointInstances
    Field Value
    Type Description
    Boolean

    m_importSceneInstances

    Declaration
    public bool m_importSceneInstances
    Field Value
    Type Description
    Boolean

    m_importSkinning

    Declaration
    public bool m_importSkinning
    Field Value
    Type Description
    Boolean

    m_importTransforms

    Declaration
    public bool m_importTransforms
    Field Value
    Type Description
    Boolean

    m_interpolation

    Declaration
    [Tooltip("Behavior to use when no value was authored at the requested time.")]
    public Scene.InterpolationMode m_interpolation
    Field Value
    Type Description
    Scene.InterpolationMode

    m_materialImportMode

    Declaration
    [Header("Import Settings")]
    public MaterialImportMode m_materialImportMode
    Field Value
    Type Description
    MaterialImportMode

    m_metallicWorkflowMaterial

    Declaration
    [Tooltip("The default material to use when importing metallic workflow USD Preview Surface materials.")]
    public Material m_metallicWorkflowMaterial
    Field Value
    Type Description
    Material

    m_normals

    Declaration
    [Tooltip("Import policy for normals, note that the 'normals' attribute is built-in, not a primvar")]
    public ImportMode m_normals
    Field Value
    Type Description
    ImportMode

    m_payloadPolicy

    Declaration
    [Tooltip("For assets with payloads authored, indicates if payloads should be loaded or unloaded by default.")]
    public PayloadPolicy m_payloadPolicy
    Field Value
    Type Description
    PayloadPolicy

    m_points

    Declaration
    [Header("Mesh Options")]
    public ImportMode m_points
    Field Value
    Type Description
    ImportMode

    m_projectAssetPath

    Declaration
    [HideInInspector]
    [Tooltip("The Unity project path into which imported files (such as textures) will be placed.")]
    public string m_projectAssetPath
    Field Value
    Type Description
    String

    m_scale

    Declaration
    [Header("Conversions")]
    [Tooltip("A scale to be applied to the root asset, useful for converting asset units to meters.")]
    public float m_scale
    Field Value
    Type Description
    Single

    m_specularWorkflowMaterial

    Declaration
    [Tooltip("The default material to use when importing specular workflow USD Preview Surface materials.")]
    public Material m_specularWorkflowMaterial
    Field Value
    Type Description
    Material

    m_st

    Declaration
    [Tooltip("Import policy for primvars:st")]
    public ImportMode m_st
    Field Value
    Type Description
    ImportMode

    m_tangents

    Declaration
    [Tooltip("Import policy for primvars:tangent")]
    public ImportMode m_tangents
    Field Value
    Type Description
    ImportMode

    m_texcoord1

    Declaration
    [HideInInspector]
    public ImportMode m_texcoord1
    Field Value
    Type Description
    ImportMode

    m_texcoord2

    Declaration
    [HideInInspector]
    public ImportMode m_texcoord2
    Field Value
    Type Description
    ImportMode

    m_texcoord3

    Declaration
    [HideInInspector]
    public ImportMode m_texcoord3
    Field Value
    Type Description
    ImportMode

    m_topology

    Declaration
    public ImportMode m_topology
    Field Value
    Type Description
    ImportMode

    m_unwrapAngleError

    Declaration
    [Tooltip("Maximum allowed angle distortion")]
    [Range(0F, 1F)]
    public float m_unwrapAngleError
    Field Value
    Type Description
    Single

    m_unwrapAreaError

    Declaration
    [Tooltip("Maximum allowed area distortion")]
    [Range(0F, 1F)]
    public float m_unwrapAreaError
    Field Value
    Type Description
    Single

    m_unwrapHardAngle

    Declaration
    [Tooltip("This angle (in degrees) or greater between triangles will cause seam to be created")]
    [Range(1F, 359F)]
    public float m_unwrapHardAngle
    Field Value
    Type Description
    Single

    m_unwrapPackMargin

    Declaration
    [Tooltip("UV-island padding in pixels")]
    [Range(0F, 32F)]
    public int m_unwrapPackMargin
    Field Value
    Type Description
    Int32

    m_usdRootPath

    Declaration
    [Tooltip("The USD prim path in the USD scene at which to start the import process.")]
    public string m_usdRootPath
    Field Value
    Type Description
    String

    m_usdTimeOffset

    Declaration
    [Tooltip("An offset applied to all data in the USD file")]
    public float m_usdTimeOffset
    Field Value
    Type Description
    Single

    m_usdVariabilityCache

    Declaration
    [Tooltip("Memorizes which attributes change over time, to speed up playback (trades time for memory)")]
    public bool m_usdVariabilityCache
    Field Value
    Type Description
    Boolean

    m_useOriginalShaderIfAvailable

    Declaration
    [Header("Material Options")]
    [Tooltip("If the original shader name is stored in USD, attempt to find that shader in this project.")]
    public bool m_useOriginalShaderIfAvailable
    Field Value
    Type Description
    Boolean

    Properties

    Length

    The length of the USD playback time in seconds.

    Declaration
    public double Length { get; }
    Property Value
    Type Description
    Double

    usdFullPath

    The absolute file path to the USD file from which this asset was created. This path may point to a location outside of the Unity project and may be any file type supported by USD (e.g. usd, usda, usdc, abc, ...). Setting this path will not trigger the asset to be reimported, Reload must be called explicitly.

    Declaration
    public string usdFullPath { get; set; }
    Property Value
    Type Description
    String

    Methods

    DestroyAllImportedObjects()

    Finds and destroys all GameObjects that were imported from USD.

    Declaration
    public void DestroyAllImportedObjects()

    ExportOverrides(Scene)

    Writes overrides over the given scene. The given scene is referenced into the override scene being exported.

    Declaration
    public void ExportOverrides(Scene sceneInWhichToStoreTransforms)
    Parameters
    Type Name Description
    Scene sceneInWhichToStoreTransforms

    GetScene()

    Returns the USD.NET.Scene object for this USD file. The caller is NOT expected to close the scene.

    Declaration
    public Scene GetScene()
    Returns
    Type Description
    Scene

    ImportUsdAsCoroutine(GameObject, String, Double, SceneImportOptions, Single)

    Imports the USD scene incrementally, setting a fixed time budget per frame for import operations. Uses StartCoroutine.

    Declaration
    public void ImportUsdAsCoroutine(GameObject goRoot, string usdFilePath, double time, SceneImportOptions importOptions, float targetFrameMilliseconds)
    Parameters
    Type Name Description
    GameObject goRoot
    String usdFilePath
    Double time
    SceneImportOptions importOptions
    Single targetFrameMilliseconds

    OptionsToState(SceneImportOptions)

    Convert the SceneImportOptions to a serializable form.

    Declaration
    public void OptionsToState(SceneImportOptions options)
    Parameters
    Type Name Description
    SceneImportOptions options

    PrepOptionsForTimeChange(ref SceneImportOptions)

    Optimizes the given import options for fast playback. This assumes that the asset was previously imported, therefore it disables import of the material and scene hierarchy.

    Declaration
    public static void PrepOptionsForTimeChange(ref SceneImportOptions options)
    Parameters
    Type Name Description
    SceneImportOptions options

    Reload(Boolean)

    Reimports the USD scene, either fully rebuilding every object or updating them in-place.

    Declaration
    public void Reload(bool forceRebuild)
    Parameters
    Type Name Description
    Boolean forceRebuild

    Destroys each GameObject before reimporting.

    RemoveAllUsdComponents()

    Finds all USD behaviors and destroys them, ignores the GameObject and other components.

    Declaration
    public void RemoveAllUsdComponents()

    SetPayloadState(GameObject, Boolean)

    Loads or unloads the given payload object. Throws an exception if game object deos not have a UsdPrimSource behaviour.

    Declaration
    public void SetPayloadState(GameObject go, bool isLoaded)
    Parameters
    Type Name Description
    GameObject go
    Boolean isLoaded

    SetTime(Double, UsdAsset, Boolean)

    Applies the contents of this USD file to a foreign root object.

    Declaration
    public void SetTime(double time, UsdAsset foreignRoot, bool saveMeshUpdates)
    Parameters
    Type Name Description
    Double time
    UsdAsset foreignRoot
    Boolean saveMeshUpdates
    Remarks

    The idea here is that one may have many animation clips, but only a single GameObject in the Unity scenegraph.

    SetVariantSelection(GameObject, String, Dictionary<String, String>)

    Sets the variant selections in USD at the given prim path based on the selections parameter.

    Declaration
    public void SetVariantSelection(GameObject go, string usdPrimPath, Dictionary<string, string> selections)
    Parameters
    Type Name Description
    GameObject go

    The gameObject at the root of the variant set.

    String usdPrimPath

    The USD prim at which to set the variant selection.

    Dictionary<String, String> selections

    A collection of (variant set, selection) pairs.

    Remarks

    A USD prim can have zero or more variant sets, for example a single prim amy have "modelingVariant" and "shadingVariant" sets. Each set can have their own slection.

    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" }

    StateToOptions(ref SceneImportOptions)

    Converts the current component state into import options.

    Declaration
    public void StateToOptions(ref SceneImportOptions options)
    Parameters
    Type Name Description
    SceneImportOptions options
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023