Esempio n. 1
0
        public static bool Initialize()
        {
            if (m_usdInitialized)
            {
                return(true);
            }

            m_usdInitialized = true;

            try {
                // Initializes native USD plugins and ensures plugins are discoverable on the system path.
                SetupUsdPath();

                // Type registration enables automatic conversion from Unity-native types to USD types (e.g.
                // Vector3[] -> VtVec3fArray).
                UnityTypeBindings.RegisterTypes();

                // The DiagnosticHandler propagates USD native errors, warnings and info up to C# exceptions
                // and Debug.Log[Warning] respectively.
                DiagnosticHandler.Register();
            } catch (System.Exception ex) {
                Debug.LogException(ex);
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public static bool Initialize()
        {
            if (m_usdInitialized)
            {
                return(true);
            }

            m_usdInitialized = true;

            try
            {
                // Initializes native USD plugins and ensures plugins are discoverable on the system path.
                SetupUsdPath();

                // The TypeBinder will generate code at runtime as a performance optimization, this must
                // be disabled when IL2CPP is enabled, since dynamic code generation is not possible.
#if ENABLE_IL2CPP
                TypeBinder.EnableCodeGeneration = false;
                Debug.Log("USD: Dynamic code generation disabled for IL2CPP.");
#endif

                // Type registration enables automatic conversion from Unity-native types to USD types (e.g.
                // Vector3[] -> VtVec3fArray).
                UnityTypeBindings.RegisterTypes();

                // The DiagnosticHandler propagates USD native errors, warnings and info up to C# exceptions
                // and Debug.Log[Warning] respectively.
                m_handler = new DiagnosticHandler();
            }
            catch (System.Exception ex)
            {
                Debug.LogException(ex);
                return(false);
            }

            return(true);
        }