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.
[ExecuteInEditMode]
public class UsdAsset : MonoBehaviour
Fields
Declaration
[HideInInspector]
public BasisTransformation LastHandedness
Field Value
Declaration
[HideInInspector]
public float LastScale
Field Value
Declaration
public ImportMode m_boundingBox
Field Value
Declaration
[Tooltip("Conversion method for right-handed (USD) to left-handed conversion (Unity) and vice versa.")]
public BasisTransformation m_changeHandedness
Field Value
Declaration
[Tooltip("Combined import policy for primvars:displayColor and primvars:displayOpacity")]
public ImportMode m_color
Field Value
Declaration
public bool m_debugPrintVariabilityCache
Field Value
Declaration
[Header("Debug Options")]
public bool m_debugShowSkeletonBindPose
Field Value
Declaration
public bool m_debugShowSkeletonRestPose
Field Value
Declaration
[Tooltip("The default material to use when importing materials as display color.")]
public Material m_displayColorMaterial
Field Value
Declaration
[HideInInspector]
[Tooltip("When enabled, set the GPU Instancing flag on all materials.")]
public bool m_enableGpuInstancing
Field Value
Declaration
[Header("Mesh Lightmap UV Unwrapping")]
public bool m_generateLightmapUVs
Field Value
Declaration
public bool m_importCameras
Field Value
Declaration
[HideInInspector]
public bool m_importHierarchy
Field Value
Declaration
public bool m_importMeshes
Field Value
Declaration
public bool m_importMonoBehaviors
Field Value
Declaration
public bool m_importPointInstances
Field Value
Declaration
public bool m_importSceneInstances
Field Value
Declaration
public bool m_importSkinning
Field Value
Declaration
public bool m_importTransforms
Field Value
Declaration
[Tooltip("Behavior to use when no value was authored at the requested time.")]
public Scene.InterpolationMode m_interpolation
Field Value
Declaration
[Header("Import Settings")]
public MaterialImportMode m_materialImportMode
Field Value
Declaration
[Tooltip("The default material to use when importing metallic workflow USD Preview Surface materials.")]
public Material m_metallicWorkflowMaterial
Field Value
Declaration
[Tooltip("Import policy for normals, note that the 'normals' attribute is built-in, not a primvar")]
public ImportMode m_normals
Field Value
Declaration
[Tooltip("For assets with payloads authored, indicates if payloads should be loaded or unloaded by default.")]
public PayloadPolicy m_payloadPolicy
Field Value
Declaration
[Header("Mesh Options")]
public ImportMode m_points
Field Value
Declaration
[HideInInspector]
[Tooltip("The Unity project path into which imported files (such as textures) will be placed.")]
public string m_projectAssetPath
Field Value
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
Declaration
[Tooltip("The default material to use when importing specular workflow USD Preview Surface materials.")]
public Material m_specularWorkflowMaterial
Field Value
Declaration
[Tooltip("Import policy for primvars:tangent")]
public ImportMode m_tangents
Field Value
Declaration
public ImportMode m_topology
Field Value
Declaration
[Tooltip("Maximum allowed angle distortion")]
[Range(0F, 1F)]
public float m_unwrapAngleError
Field Value
Declaration
[Tooltip("Maximum allowed area distortion")]
[Range(0F, 1F)]
public float m_unwrapAreaError
Field Value
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
Declaration
[Tooltip("UV-island padding in pixels")]
[Range(0F, 32F)]
public int m_unwrapPackMargin
Field Value
Declaration
[Tooltip("The USD prim path in the USD scene at which to start the import process.")]
public string m_usdRootPath
Field Value
Declaration
[Tooltip("An offset applied to all data in the USD file")]
public float m_usdTimeOffset
Field Value
Declaration
[Tooltip("Memorizes which attributes change over time, to speed up playback (trades time for memory)")]
public bool m_usdVariabilityCache
Field Value
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
Properties
The length of the USD playback time in seconds.
Declaration
public double Length { get; }
Property Value
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
Methods
Finds and destroys all GameObjects that were imported from USD.
Declaration
public void DestroyAllImportedObjects()
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 |
|
Returns the USD.NET.Scene object for this USD file.
The caller is NOT expected to close the scene.
Declaration
Returns
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
Convert the SceneImportOptions to a serializable form.
Declaration
public void OptionsToState(SceneImportOptions options)
Parameters
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
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.
|
Finds all USD behaviors and destroys them, ignores the GameObject and other components.
Declaration
public void RemoveAllUsdComponents()
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
Applies the contents of this USD file to a foreign root object.
Declaration
public void SetTime(double time, UsdAsset foreignRoot, bool saveMeshUpdates)
Parameters
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.
|
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" }
Converts the current component state into import options.
Declaration
public void StateToOptions(ref SceneImportOptions options)
Parameters
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.